Build Turkish catalogs.
[AROS-Contrib.git] / bgui / RexxBGUI / testlistview.rexx
blob026b354a258d52b1e033f006cb065f9d24bcd28a
1 /* REXX script for rexxbgui.library: test new listview functions */
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
25 FixMinSize=bguilayout(LGO_FixMinWidth,1,LGO_FixMinHeight,1)
27 /* using ARexx feature: ,<newline> is translated to nothing */
28 /* the || are essential - any added space will cause trouble */
29 /* redefining the same ID makes previous buttons unaccessible */
30 /* do not redefine winclose etc. */
32 g=bguivgroup(,
33 bguivgroup(,
34 bguilistview('listv',,bguilist('it','Item 1','Item 2'),'D')||,
35 bguihgroup(,
36 bguibutton('add','_Add')||,
37 bguibutton('rem','_Remove')||,
38 bguibutton('sort','_Sort'),
39 ,0,,,'W')||bguilayout(LGO_FixMinHeight,1)||,
40 bguistring('str',,'New Item',80)||bguilayout(LGO_FixMinHeight,1),
41 ,0)||,
42 bguihgroup(,
43 bguivarspace(50)||,
44 bguibutton('quit','_Quit')||,
45 bguivarspace(50),
46 )||bguilayout(LGO_FixMinHeight,1),
47 ,grspace.normal,grspace.normal)
49 drop it.
51 call bguiset(obj.rem,,GA_Disabled,1)
52 call bguiaddmap(obj.listv,obj.str,LISTV_Entry,STRINGA_TextVal)
54 a=bguiwindow('Listview',g,40,70,,arg(1))
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.str then do
61 call bguilistvreplacesel(obj.listv,a,,
62 bguiget(obj.str,STRINGA_TextVal))
63 call bguiset(obj.rem,a,GA_Disabled,0)
64 end
65 when id=id.add then do
66 call bguilistvaddentry(obj.listv,a,,
67 '<new>',,'S')
68 call bguiset(obj.rem,a,GA_Disabled,0)
69 call bguiset(obj.str,a,STRINGA_TextVal,'')
70 call bguiactivategadget(obj.str,a)
71 end
72 when id=id.listv then do
73 call bguiset(obj.rem,a,GA_Disabled,0)
74 end
75 when id=id.rem then do
76 call bguilistvcommand(obj.listv,a,'remselected')
77 if bguiget(obj.listv,'LISTV_NumEntries')=0 then,
78 call bguiset(obj.rem,a,GA_Disabled,1)
79 end
80 when id=id.sort then call bguilistvcommand(obj.listv,a,'sort')
81 when id=id.winactive then nop
82 when id=id.wininactive then nop
83 when id=id.quit then leave
84 when id=id.winclose then nop
85 otherwise nop
86 end
87 end
88 rc=0
90 syntax:
91 if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
92 call bguiclose()
93 exit 0
95 break_c:
96 halt:
97 rc=0
98 say '+++ Break at line' sigl
99 signal syntax