Properties

This commit is contained in:
David Botton 2020-12-18 13:50:44 -05:00
parent 82cdf0aabf
commit cda2475f08
2 changed files with 30 additions and 3 deletions

View file

@ -45,14 +45,18 @@ application."
(defsection @clog-objs (:title "CLOG Objects")
"CLOG Obj"
"CLOG-Obj"
(clog-obj class)
"CLOG Obj - Low Level Creation"
"CLOG-Obj - General"
(property generic-function)
(set-property generic-function)
"CLOG-Obj - Low Level Creation"
(create-child generic-function)
(attach-as-child generic-function)
"CLOG Obj - Placement"
"CLOG-Obj - Placement"
(place-after generic-function)
(place-before generic-function)
(place-inside-top-of generic-function)
@ -121,6 +125,26 @@ result. (Private)"))
(cc:query (connection-id obj)
(format nil "~A.~A" (jquery obj) method)))
;;;;;;;;;;;;;;
;; property ;;
;;;;;;;;;;;;;;
(defgeneric property (clog-obj property-name)
(:documentation "Return PROPERTY-NAME's value for CLOG-OBJ"))
(defmethod property ((obj clog-obj) property-name)
(jquery-query obj (format nil "prop('~A')" property-name)))
;;;;;;;;;;;;;;;;;;
;; set-property ;;
;;;;;;;;;;;;;;;;;;
(defgeneric set-property (clog-obj property-name value)
(:documentation "Set PROPERTY-NAME to VALUE for CLOG-OBJ"))
(defmethod set-property ((obj clog-obj) property-name value)
(jquery-execute obj (format nil "prop('~A','~A')" property-name value)))
;;;;;;;;;;;;;;;;;;
;; create-child ;;
;;;;;;;;;;;;;;;;;;

View file

@ -11,6 +11,9 @@
(clog-connection:put-line (clog::connection-id win) "<button id='myid'>In html</button>")
(setf tmp (attach-as-child win "myid"))
(clog::jquery-execute tmp "css('background-color','red')")
(set-property tmp "draggable" "true")
(when (equal (property tmp "draggable")
(set-property tmp "innerHTML" "<h2>I am draggable</h2>")))
(create-child win "<button>test</botton>")
(create-child win "<H2>Cool!</H2>")
(setf *last-obj* (create-child win "<button>a</button>"))))