pm-01 mavis risetti

This commit is contained in:
David Botton 2021-03-02 12:56:21 -05:00
parent bcbd88b3c7
commit a171cb9162
2 changed files with 41 additions and 0 deletions

View file

@ -2,3 +2,4 @@ Various source files indexed by their discussion or tickets on github
I created in supporting questions. I created in supporting questions.
* disc-38.lisp - use of the rgb function to compare colors * disc-38.lisp - use of the rgb function to compare colors
* pm-01.list - create-child and :clog-type

40
support/pm-01.lisp Normal file
View file

@ -0,0 +1,40 @@
;; mavis risetti PM on discord
(defpackage #:web
(:use #:cl #:clog #:clog-gui)
(:export start-web-app))
(in-package :web)
(defun on-new-window (body)
(clog-gui-initialize body)
(let ((ta (create-child body "<textarea>1</textarea>"))
(gv (create-button body :content "Show me the value")))
;; This code will fail. The reason is that create-child by default
;; creates on object of type clog-element and value does not exist
;; clog-element
(set-on-click gv (lambda (obj)
(alert-dialog body :content (value ta)))))
(let ((ta (create-child body "<textarea>2</textarea>"
:clog-type 'clog:clog-form-element))
(gv (create-button body :content "Show me the value")))
;; This code will work.
(set-on-click gv (lambda (obj)
(alert-dialog body (value ta)))))
(let ((ta (create-text-area body)) ;; Returns a clog-text-area
(gv (create-button body :content "Show me the value")))
;; This code is the idea using a clog-text-area returned
(set-on-click gv (lambda (obj)
(alert-dialog body (value ta)))))
(run body))
(defun start-web-app ()
"Start the App!"
(initialize #'on-new-window)
(open-browser))