complex http example fix
[k8lst.git] / samples / guiTest.st
blobfddae6c7185b7c96e47d52de619dc8570698b32c
1 Requires [ gui ]
18   | box dlg l0 l1 spl rb |
19   System newProcessGroupWith: (Process newWithMethod: #REPL class: REPL new).
21   (box := GuiVBox new);
22     add: (GuiToggle new: 'radio 0' action: [ 'radio 0 toggled' printNl ]; checked: true);
23     add: (GuiToggle new: 'radio 1' action: [ 'radio 1 toggled' printNl ]; checked: true);
24     add: (GuiToggle new: 'radio 2' action: [ 'radio 2 toggled' printNl ]; checked: true);
25   .
26   rb := GuiRadioBox new: box.
28   l0 := GuiList new; << 'list 0 item 0'; << 'list 0 item 1'.
29   l1 := GuiList new; << 'list 1 item 0'; << 'list 1 item 1'.
30   l1 enabled: false.
31   (spl := GuiSplit new); add: l0; add: l1.
32   (box := GuiVBox new);
33     add: (GuiLabel new: 'label');
34     add: (GuiButton new: 'test &button' action: [ 'test button pressed' printNl. GuiSingleton setQuitFlag ]);
35     add: (GuiToggle new: 'tog&gle 0' action: [ 'toggle 0 toggled' printNl ]; checked: true);
36     add: (GuiProgressBar new);
37     add: (GuiHTrackBar new: [:v | 'trackbar value changed: ' print. v printNl ]; max: 666; value: 42);
38     add: (GuiEdit new: [:t | 'text: ' print. t printNl ]);
39     add: (GuiList new: [:i :sel | 'item #' print. i print. ' is ' print. sel ifFalse: ['un' print]. 'selected' printNl];
40       << 'item 0';
41       << 'item 1';
42       );
43     add: rb;
44     add: spl;
45     .
46   dlg := GuiDialog new: 'First Dialog Window' widget: box onClose: [ GuiSingleton setQuitFlag ].
47   dlg attribute: 'RESIZE' value: 'NO'.
48   "dlg attribute: 'TRAY' value: 'YES'."
49   dlg show.
50   "GuiSingleton message: 'starting GUI loop...'."
51   GuiSingleton add: dlg.
52   GuiSingleton mainLoop.