1 /* REXX script for rexxbgui.library: progress bar */
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 */
24 FixMinWidth
=bguilayout
(LGO_FixMinWidth
,1)
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 gadgets inaccessible */
29 /* do not redefine winclose etc. */
31 text
=esc
'cNew features demonstrated'lf
'in this example:'lf
||,
32 '· Progress bar'lf
'· Indicator'lf
'· Opening a window'lf
||,
36 bguiinfo
('inf',,text
)||,
37 bguiprogress
('prog1',,0,100,'%ld%%')||,
39 bguiprogress
('prog2','Progress',0,100)||,
40 bguiindicator
('indic2',,0,100,0,'C','%ld%%')||FixMinWidth
,
43 bguibutton
('do','_Do something')||,
45 bguibutton
('abort','_Abort'),
46 ,/*spc*/,/*offs*/,/*title*/,'W'),
49 call bguiaddmap
(obj
.prog2
,obj
.indic2
,PROGRESS_Done
,INDIC_Level
)
51 a
=bguiwindow
('RexxBGUI new 2.0 features',g
,50,'-0',,arg(1),'*')
52 if bguiwinopen
(a
)=0 then bguierror
(12)
54 do while bguiwinwaitevent
(a
,'ID')~
=id
.winclose
56 when id
=id
.winactive
then nop
57 when id
=id
.wininactive
then nop
59 p
=bguiget
(obj
.prog1
,PROGRESS_Done
)+10
60 call bguiset
(obj
.prog1
,a
,PROGRESS_Done
,p
)
61 call bguiset
(obj
.prog2
,a
,PROGRESS_Done
,p
)
62 if p
=100 then do; call bguiwinbusy
(a
); address command wait
1; leave; end; else nop
64 when id
=id
.abort
then leave
65 when id
=id
.winclose
then nop
72 if rc~
=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
79 say '+++ Break at line' sigl