Tutorial 4 updates

This commit is contained in:
David Botton 2021-01-06 14:28:10 -05:00
parent 34971a7c90
commit 6d8467caf4
2 changed files with 7 additions and 3 deletions

View file

@ -4,8 +4,8 @@
(in-package :clog-user)
(defun my-on-click (obj)
(setf (color obj) "green"))
(defun my-on-click (obj) ; obj in any event is the target of the event
(setf (color obj) "green")) ; this makes it possible to reuse events
(defun on-new-window (body)
"On-new-window handler."
@ -13,6 +13,9 @@
(setf (title (html-document body)) "Tutorial 4")
(set-on-click (create-child body "<h1>Hello World! (click me!)</h1>")
#'my-on-click)
(set-on-click (create-child body "<h3>Click me too!</h3>")
#'my-on-click))
(defun start-tutorial ()

View file

@ -36,4 +36,5 @@ Tutorial Summary
01-tutorial.lisp - Hello World
02-tutorial.lisp - Closures in CLOG
03-tutorial.lisp - Events fire in parallel
05-tutorial.lisp - The event target, reusing event handlers
05-tutorial.lisp - Using connection-data-item