(in-package :snow-user)
(in-readtable snow:syntax)
(let ((clicks (make-var 0)) tf)
(flet ((submit ()
(setf (widget-text tf) (str (widget-text tf) "#"))
(incf (var clicks))))
(with-gui ()
(frame (:size #C(640 280) :title "Hello Snow World" :on-close :exit)
(panel (:layout "grow, wrap")
;;labelfor="tf"
(text-field :id tf :text "Snow"
:label (label :text "Hello World!"
:font (font "Georgia" 12 :bold)
:foreground :blue));;columns="20"
(button :text "Click Here" :on-action #'submit))
(panel (:layout "dock south")
(label :text "Clicks:" :font (font "Georgia" 36 :bold))
(label :font (font "Georgia" 36 :bold) :text $(c? (str (var clicks)))))
(show self)))))
#||
The original example used the SwiXml idiom of coding a Java class to handle
the events; an instance of this class gets injected the components with an
ID into its JavaBean properties.
The Snow version does not rely on a Java class; instead it handles events in
Lisp and uses data binding to update the GUI. It is of course possible to
handle the events in Java, but Snow does not currently support automatic
injection of widgets into the properties of a Java object.
||#
#|| Original example:
||#