From 9c70997da75b4f1d83538b9b4c7d6d73b1239d78 Mon Sep 17 00:00:00 2001 From: David Botton Date: Sun, 23 Jan 2022 18:55:38 -0500 Subject: [PATCH] Small bug fixes --- source/clog-canvas.lisp | 22 +++++++++++++++++----- source/clog-form.lisp | 9 +++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/source/clog-canvas.lisp b/source/clog-canvas.lisp index 3cfe56e..8cbee3b 100644 --- a/source/clog-canvas.lisp +++ b/source/clog-canvas.lisp @@ -19,15 +19,27 @@ ;; 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 :AUTO-PLACE (default t) place-inside-bottom-of CLOG-OBJ.")) (defmethod create-canvas ((obj clog-obj) - &key (width 300) (height 150) (auto-place t)) - (create-child obj (format nil "" + &key (width 300) (height 150) + (class nil) (hidden nil) + (html-id nil) (auto-place t)) + (create-child obj (format nil "" + (if class + (format nil " class='~A'" + (escape-string class)) + "") + (if hidden + " style='visibility:hidden;'" + "") 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 @@ -49,7 +61,7 @@ (format nil "clog['~A']=clog['~A'].getContext('2d')" web-id (html-id obj))) - + (make-instance 'clog-context2d :connection-id (connection-id obj) :html-id web-id))) diff --git a/source/clog-form.lisp b/source/clog-form.lisp index eaeeff2..f0e6370 100644 --- a/source/clog-form.lisp +++ b/source/clog-form.lisp @@ -179,7 +179,8 @@ elements.")) :reset :search :submit :tel :text :time :url :week)) (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. 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.")) @@ -189,14 +190,18 @@ clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME.")) (value nil) (label nil) (class nil) + (hidden nil) (html-id nil)) (let ((element (create-child - obj (format nil "" + obj (format nil "" (escape-string element-type) (if class (format nil " class='~A'" (escape-string class)) "") + (if hidden + " style='visibility:hidden;'" + "") (if value (format nil " value='~A'" value) "")