1 /* REXX script for rexxbgui.library: listview control with arrow keys */
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 if bguirexxversion
(4)=0 then do
29 'This script requires at'lf
||,
30 'least RexxBGUI version 4.','*_Abort','Sorry!')
35 /* using ARexx feature: ,<newline> is translated to nothing */
36 /* the || are essential - any added space will cause trouble */
37 /* redefining the same ID makes previous buttons unaccessible */
38 /* do not redefine winclose etc. */
42 'info',,'\ec\ebRexxBGUI\e-b new 4.0 feature: listview control with arrow keys',
43 )||bguilayout
(LGO_FixMinHeight
,1)||,
47 bguicheckbox
('actrl','Enable _arrow control',1)FixMinSize
||,
48 bguicheckbox
('genmsg','_Generate messages for arrow keys',0)FixMinSize
||,
49 bguicheckbox
('doenter','Generate messages for _return key',0)FixMinSize
,
52 )||bguilayout
(LGO_FixMinHeight
,1)||,
55 bguilist
('entries','Entry 1','Entry 2','Entry 3','Entry 4','Entry 5',,
56 'Entry 6','Entry 7','Entry 8','Entry 9','Entry 10','Entry 11',,
57 'Entry 12','Entry 13','Entry 14'),
61 bguibutton
('quit','_Quit')||,
63 )||bguilayout
(LGO_FixMinHeight
,1),
64 ,grspace
.normal
,grspace
.normal
)
68 call bguiaddcondit
(obj
.actrl
,obj
.genmsg
,GA_Selected
,0,GA_Disabled
,1,GA_Disabled
,0)
69 call bguiaddcondit
(obj
.actrl
,obj
.doenter
,GA_Selected
,0,GA_Disabled
,1,GA_Disabled
,0)
70 /* This statement disables the two other checkboxes. For this to work,
71 obj.actrl must be initialized to on. */
72 call bguiset
(obj
.actrl
,,GA_Selected
,0)
74 call bguilistvcontrol
(,,0,0) /* set up defaults */
76 a
=bguiwindow
('Arrow control',g
,0,0,,arg(1),'mouse')
78 if bguiwinopen
(a
)=0 then bguierror
(12)
80 do while bguiwinwaitevent
(a
,'ID')~
=id
.winclose
82 when id
=id
.actrl
then do
83 if 0~
=bguiget
(obj
.actrl
,GA_Selected
) then do
84 call bguilistvcontrol
(obj
.listv
,a
)
86 call bguilistvcontrol
()
89 when id
=id
.genmsg
then do
90 if 0~
=bguiget
(obj
.genmsg
,GA_Selected
) then do
91 call bguilistvcontrol
(,,id
.listv
)
93 call bguilistvcontrol
(,,0)
96 when id
=id
.doenter
then do
97 if 0~
=bguiget
(obj
.doenter
,GA_Selected
) then do
98 call bguilistvcontrol
(,,,id
.enter
)
100 call bguilistvcontrol
(,,,0)
103 when id
=id
.listv
then say 'Received id.listv.'
104 when id
=id
.enter
then say 'Received id.enter.'
105 when id
=id
.quit
then leave
106 when id
=id
.winclose
then nop
113 if rc~
=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
120 say '+++ Break at line' sigl