From 6d8467caf4042023bcece66277631d39d6f634b1 Mon Sep 17 00:00:00 2001 From: David Botton Date: Wed, 6 Jan 2021 14:28:10 -0500 Subject: [PATCH] Tutorial 4 updates --- tutorial/04-tutorial.lisp | 7 +++++-- tutorial/README.md | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tutorial/04-tutorial.lisp b/tutorial/04-tutorial.lisp index 614296e..6d374a8 100644 --- a/tutorial/04-tutorial.lisp +++ b/tutorial/04-tutorial.lisp @@ -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 "

Hello World! (click me!)

") + #'my-on-click) + + (set-on-click (create-child body "

Click me too!

") #'my-on-click)) (defun start-tutorial () diff --git a/tutorial/README.md b/tutorial/README.md index ef3c082..e74289d 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -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