Small bug fixes

This commit is contained in:
David Botton 2022-01-23 18:55:38 -05:00
parent 8b461624bb
commit 9c70997da7
2 changed files with 24 additions and 7 deletions

View file

@ -19,15 +19,27 @@
;; create-canvas ;; ;; create-canvas ;;
;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;
(defgeneric create-canvas (clog-obj &key width height auto-place) (defgeneric create-canvas (clog-obj &key width height
class hidden html-id auto-place)
(:documentation "Create a new CLOG-Canvas as child of CLOG-OBJ if (:documentation "Create a new CLOG-Canvas as child of CLOG-OBJ if
:AUTO-PLACE (default t) place-inside-bottom-of CLOG-OBJ.")) :AUTO-PLACE (default t) place-inside-bottom-of CLOG-OBJ."))
(defmethod create-canvas ((obj clog-obj) (defmethod create-canvas ((obj clog-obj)
&key (width 300) (height 150) (auto-place t)) &key (width 300) (height 150)
(create-child obj (format nil "<canvas width=~A height=~A/>" (class nil) (hidden nil)
(html-id nil) (auto-place t))
(create-child obj (format nil "<canvas~A~A width=~A height=~A/>"
(if class
(format nil " class='~A'"
(escape-string class))
"")
(if hidden
" style='visibility:hidden;'"
"")
width height) width height)
:clog-type 'clog-canvas :auto-place auto-place)) :clog-type 'clog-canvas
:html-id html-id
:auto-place auto-place))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - clog-context2d ;; Implementation - clog-context2d
@ -49,7 +61,7 @@
(format nil "clog['~A']=clog['~A'].getContext('2d')" (format nil "clog['~A']=clog['~A'].getContext('2d')"
web-id web-id
(html-id obj))) (html-id obj)))
(make-instance 'clog-context2d (make-instance 'clog-context2d
:connection-id (connection-id obj) :connection-id (connection-id obj)
:html-id web-id))) :html-id web-id)))

View file

@ -179,7 +179,8 @@ elements."))
:reset :search :submit :tel :text :time :url :week)) :reset :search :submit :tel :text :time :url :week))
(defgeneric create-form-element (clog-obj element-type (defgeneric create-form-element (clog-obj element-type
&key name value label class html-id) &key name value label class
hidden html-id)
(:documentation "Create a new clog-form-element as child of CLOG-OBJ. (:documentation "Create a new clog-form-element as child of CLOG-OBJ.
It is importamt that clog-form-elements are a child or descendant of a It is importamt that clog-form-elements are a child or descendant of a
clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME.")) clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
@ -189,14 +190,18 @@ clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
(value nil) (value nil)
(label nil) (label nil)
(class nil) (class nil)
(hidden nil)
(html-id nil)) (html-id nil))
(let ((element (create-child (let ((element (create-child
obj (format nil "<input type='~A'~A~A~A/>" obj (format nil "<input type='~A'~A~A~A~A/>"
(escape-string element-type) (escape-string element-type)
(if class (if class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class))
"") "")
(if hidden
" style='visibility:hidden;'"
"")
(if value (if value
(format nil " value='~A'" value) (format nil " value='~A'" value)
"") "")