3 ; button-demo.lsp - demonstrate the button control
7 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
13 (gs:frame
'ButtonDemo
100 100 400 300 "Click on button or color panel")
14 (gs:set-resizable
'ButtonDemo nil
)
15 (gs:panel
'ColorPanel
360 200)
16 (gs:set-background
'ColorPanel
'(0 1 0) 0.2)
17 (gs:button
'aButton
'button-action
"color")
18 (gs:set-flow-layout
'ButtonDemo
"center" 2 15)
19 (gs:add-to
'ButtonDemo
'ColorPanel
'aButton
)
20 (gs:set-visible
'ButtonDemo true
)
22 (gs:mouse-event
'ColorPanel
'mouse-action
)
25 (define (button-action id
)
26 (gs:set-color
'ColorPanel
(random) (random) (random)))
28 (define (mouse-action id type x y button cnt mods
)
29 (gs:set-text
'ButtonDemo
(format "%8s %3d:%3d %d %d %2d" type x y button cnt mods
))
32 ;;;; listen for incoming action requests and dispatch