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
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
15 signal on syntax /* important: bguiclose() MUST be called */
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. */
34 bguilistview
('listv',,bguilist
('it','Item 1','Item 2'),'D')||,
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),
44 bguibutton
('quit','_Quit')||,
46 )||bguilayout
(LGO_FixMinHeight
,1),
47 ,grspace
.normal
,grspace
.normal
)
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)
58 do while bguiwinwaitevent
(a
,'ID')~
=id
.winclose
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)
65 when id
=id
.add
then do
66 call bguilistvaddentry
(obj
.listv
,a
,,
68 call bguiset
(obj
.rem
,a
,GA_Disabled
,0)
69 call bguiset
(obj
.str
,a
,STRINGA_TextVal
,'')
70 call bguiactivategadget
(obj
.str
,a
)
72 when id
=id
.listv
then do
73 call bguiset
(obj
.rem
,a
,GA_Disabled
,0)
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)
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
91 if rc~
=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
98 say '+++ Break at line' sigl