Bringing ChocolateCaste-0.7 into the main branch.
[AROS-Contrib.git] / bgui / RexxBGUI / testbgui.rexx
blob5237b77361caa76016a8e6b34e0798351f52ee22
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 grspace.narrow=-1
22 grspace.normal=-2
23 grspace.wide=-3
25 /* using ARexx feature: ,<newline> is translated to nothing */
26 /* the || are essential - any added space will cause trouble */
27 /* redefining the same ID makes previous buttons unaccessible */
28 /* do not redefine winclose etc. */
29 /* note the bold button: <return> is the shortcut key */
31 bla=bguihgroup(,
32 bguibutton('but1',esc's'esc'd3'||'_Change text')||,
33 bguibutton('but2',esc'i'||'Disable')||,
34 bguivgroup(,
35 bguibutton('but3','AAA')||,
36 bguibutton('but4',esc'u'||'_Enable'),
37 ,grspace.narrow)||,
38 bguibutton('but5','A_AA')||,
39 bguibutton('but6',esc'b'||esc'k'||'<RETURN> as'lf'shortcut_'||'0d'x),
40 ,grspace.narrow)
41 inf=bguiinfo('info','Info','Using BGUI from ARexx'lf'via',
42 'rexxbgui.library')
43 b=bguibutton('butrq','Show _BGUI_RequestA')||bguibutton('quit','_Quit')
44 g=bguivgroup(inf||bla||b,grspace.normal,grspace.normal)
45 a=bguiwindow('BGUI from ARexx!',g,50,'-0',,arg(1))
46 if bguiwinopen(a)=0 then bguierror(12)
47 id=0
48 do while bguiwinwaitevent(a,'ID')~=id.winclose
49 select
50 when id=id.winactive then nop
51 when id=id.wininactive then nop
52 when id=id.butrq then call bguireq('Button pressed!','*_OK',,a)
53 when id=id.but1 then call bguiset(obj.info,a,INFO_TextFormat,esc||'c%%% percent sign%s!')
54 when id=id.but2 then call bguiset(obj.but3,a,GA_Disabled,1)
55 when id=id.but4 then call bguiset(obj.but3,a,GA_Disabled,0)
56 when id=id.quit then leave
57 when id=id.winclose then nop
58 when id=id.winnomore then call bguiwait() /* to test bguiwinevent() */
59 otherwise
60 end
61 end
62 rc=0
64 syntax:
65 if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
66 call bguiclose()
67 exit 0
69 break_c:
70 halt:
71 rc=0
72 say '+++ Break at line' sigl
73 signal syntax