factor/contrib/x11/examples/example-03.factor

38 lines
1019 B
Factor
Raw Normal View History

2006-01-02 13:42:24 -05:00
2006-05-24 06:55:00 -04:00
USING: kernel namespaces sequences io x concurrency concurrent-widgets ;
2006-01-02 13:42:24 -05:00
SYMBOL: win-a
SYMBOL: button-a
SYMBOL: button-b
SYMBOL: button-c
f initialize-x
create-window-object win-a set
win-a get [ "black" lookup-color set-window-background ] with-window-object
"Hey Hey Hey" [ "button pressed" print ] create-button button-a set
"Yo Yo Yo" [ "button pressed" print ] create-button button-b set
"Foo" [ "button pressed" print ] create-button button-c set
[ button-a button-b button-c ] [ "red" "green" "blue" ]
[ lookup-color swap get [ set-window-background ] with-window-object ]
2each
[ button-a button-b button-c ]
[ get [ { 100 20 } resize-window ] with-window-object ]
each
[ button-a button-b button-c ]
[ get [ win-a get window-id reparent-window ] with-window-object ]
each
win-a get [ map-window ] with-window-object
[ button-a button-b button-c ] [ get [ map-window ] with-window-object ]
each
win-a get [ arrange-children-vertically ] with-window-object
[ concurrent-event-loop ] spawn