further work on presentations - transformers

This commit is contained in:
David Botton 2022-02-14 18:24:19 -05:00
parent fa80acb1a1
commit ddcb66235d
2 changed files with 19 additions and 8 deletions

View file

@ -24,11 +24,18 @@
(i3 (create-form-element body :text
:label (create-label body :content "Change my-count:"))))
;; We set up direct relationships between lisp obj and clog objects
(link-form-element-to-slot i1 lisp-obj my-slot) ;; any change to i1 will change my-slot
(link-slot-to-form-element lisp-obj my-slot i1) ;; any change to my-slot will change i1
(link-slot-to-element lisp-obj my-count t1) ;; any change to my-count will change h1
;; any change to i1 will change my-slot
(link-form-element-to-slot i1 lisp-obj my-slot)
;; any change to my-slot will change i1 after transforming
;; my-slot to upercase
(link-slot-to-form-element lisp-obj my-slot i1
:transform #'string-upcase)
;; any change to my-count will change t1
(link-slot-to-element lisp-obj my-count t1)
;; any change to i3 will change my-count
;; and i3's value will be transformed to an integer
(link-form-element-to-object
i3 (my-count lisp-obj) :transform #'parse-integer) ;; any change to i3 will change my-count
i3 (my-count lisp-obj) :transform #'parse-integer)
;; This change of my-slot will immediately change in the web page
(setf (my-slot lisp-obj) "First Value")
(set-on-click b1