Bringing ChocolateCaste-0.7 into the main branch.
[AROS-Contrib.git] / bgui / RexxBGUI / testbgui2.rexx
blobffb0f52d545c7d113b32db2d66a441b81827ee15
1 /* REXX test script for rexxbgui.library */
3 if ~show('l','rexxbgui.library') then do
4 if ~addlib('rexxbgui.library',0,-30) then do
5 exit(20)
6 end
7 else nop
8 end
9 else nop
11 call bguiopen() /* causes error 12 if it did not work */
12 /* supply a second argument for a '0' return code instead of an ARexx
13 error */
15 signal on syntax /* important: bguiclose() MUST be called */
16 signal on halt
17 signal on break_c
19 esc='1B'x
20 lf='0A'x
21 cr='0D'x
22 grspace.narrow=-1
23 grspace.normal=-2
24 grspace.wide=-3
26 /* using ARexx feature: ,<newline> is translated to nothing */
27 /* the || are essential - any added space will cause trouble */
28 /* redefining the same ID makes previous buttons unaccessible */
29 /* do not redefine winclose etc. */
31 g=bguivgroup(,
32 bguistring('str1','String #_1','max 10',10)||,
33 bguistring('str2','String #_2','Not in tabcycle chain.',30)||,
34 bguistring('str3','String #_3','text',30)||,
35 bguiinteger('int1','_Integer')||,
36 bguiinfo('inf1','Info',esc's'esc'd3'||'Enter something in string #2!')||,
37 bguihgroup(,
38 bguitoggle('toggle','_Disable checkbox')||,
39 bguivarspace(1000)||,
40 bguicheckbox('check','Dis_able OK button'),
41 ,grspace.normal,'FRAME','Two notifying gadgets')||,
42 bguihgroup(,
43 bguibutton('show','_Show values')||,
44 bguivarspace(50)||,
45 bguibutton('ok',esc'b'||'OK_'cr),
46 ,grspace.normal),
47 ,grspace.normal,grspace.normal)
49 a=bguiwindow('BGUI from ARexx!',g,50,'-0',,arg(1))
51 call bguiwintabcycleorder(a,obj.str1||obj.str3||obj.int1)
52 call bguiaddmap(obj.str2,obj.inf1,STRINGA_TextVal,INFO_TextFormat)
53 call bguiaddmap(obj.toggle,obj.check,GA_Selected,GA_Disabled)
54 call bguiaddmap(obj.check,obj.ok,GA_Selected,GA_Disabled)
56 if bguiwinopen(a)=0 then bguierror(12)
57 id=0
58 do while bguiwinwaitevent(a,'ID')~=id.winclose
59 select
60 when id=id.winactive then nop
61 when id=id.wininactive then nop
62 when id=id.show then do
63 text=bguiget(obj.str1,STRINGA_TextVal)lf||,
64 bguiget(obj.str2,STRINGA_TextVal)lf||,
65 bguiget(obj.str3,STRINGA_TextVal)lf||,
66 bguiget(obj.int1,STRINGA_LongVal)
67 call bguireq('Results are:'lf||text,'*_OK',,a)
68 end
69 when id=id.ok then leave
70 when id=id.winclose then nop
71 when id=id.winnomore then call bguiwait() /* to test bguiwinevent() */
72 otherwise
73 end
74 end
75 rc=0
77 syntax:
78 if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
79 call bguiclose()
80 exit 0
82 break_c:
83 halt:
84 rc=0
85 say '+++ Break at line' sigl
86 signal syntax