Initial commit of newLISP.
[newlisp.git] / guiserver / move-resize-demo.lsp
blobe98eec3d66e60a82393513253eb01d10e33b74dc
1 #!/usr/bin/newlisp
2 ;;
3 ; move-resize-demo.lsp - demonstrate gs:window-moved and hs:window-resized events
5 ;;;; initialization
6 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
8 (gs:init)
9 ;(gs:set-trace true)
11 ;;;; describe the GUI
12 (gs:frame 'EventDemo 100 100 300 100 "Move or resize window")
13 (gs:set-border-layout 'EventDemo)
14 (gs:label 'Position "")
15 (gs:label 'Size "")
16 (gs:set-font 'Position "Mono Spaced" 24 "bold")
17 (gs:set-foreground 'Position 0 0 0.5 )
18 (gs:set-font 'Size "Mono Spaced" 24 "bold")
19 (gs:set-foreground 'Size 0 0 0.5 )
21 (gs:add-to 'EventDemo 'Position "north")
22 (gs:add-to 'EventDemo 'Size "south")
24 (gs:window-moved 'EventDemo 'move-action)
25 (gs:window-resized 'EventDemo 'resize-action)
27 ;;;; define actions
29 (define (move-action id x y)
30 (gs:set-text 'Position (string "Position " x ":" y)))
32 (define (resize-action id width height)
33 (gs:set-text 'Size (string "Size " width ":" height)))
36 (gs:set-visible 'EventDemo true)
38 ;;;; listen for incoming action requests and dispatch
39 (gs:listen)
41 ;; eof