Bringing ChocolateCaste-0.7 into the main branch.
[AROS-Contrib.git] / bgui / RexxBGUI / activitydata.rexx
blob8efd6a1e48f598bfd73656e0fba7d12463971d06
1 /* REXX */
2 /* REXX script for rexxbgui.library: show Activity data files */
4 if ~show('l','rexxbgui.library') then do
5 if ~addlib('rexxbgui.library',0,-30) then do
6 exit(20)
7 end
8 else nop
9 end
10 else nop
12 call bguiopen() /* causes error 12 if it did not work */
13 /* supply a second argument for a '0' return code instead of an ARexx
14 error */
16 esc='1B'x
17 lf='0A'x
18 cr='0D'x
19 tab='09'x
20 grspace.narrow=-1
21 grspace.normal=-2
22 grspace.wide=-3
24 fname=arg(1)
25 if fname='' then do
26 options results
27 address ACTIVITY
28 'GET FILE'
29 if rc>0 then bguierror(12); else nop
30 fname=result
31 end; else nop
33 if bguireadentries(fname,'LST')~=1 then bguierror(12); else nop
35 flag=0
36 do i=0 for lst.count
37 if flag then do
38 lst.i=translate(lst.i,tab,';')
39 end; else do
40 if substr(lst.i,1,1)='-' then flag=1
41 drop lst.i
42 end
43 end
45 signal on syntax /* important: bguiclose() MUST be called */
46 signal on halt
47 signal on break_c
49 /* using ARexx feature: ,<newline> is translated to nothing */
50 /* the || are essential - any added space will cause trouble */
51 /* redefining the same ID makes previous buttons unaccessible */
52 /* do not redefine winclose etc. */
54 g=bguivgroup(,
55 bguilistview('listv',,'LST',ReadOnly,7)||,
56 bguihgroup(,
57 bguivarspace(50)||,
58 bguibutton('quit','_Quit')||,
59 bguivarspace(50),
60 )||bguilayout(LGO_FixMinHeight,1),
61 ,grspace.normal,grspace.normal)
63 a=bguiwindow('User activity:' fname,g,50,90)
65 title='Date'tab'Time'tab'Left'tab'Right'tab'Move'tab'Keys'tab'Middle'
66 mem=getspace(length(title)+1)
67 if mem='00000000'x then bguierror(12)
68 call export(mem,title'00'x)
69 call bguiset(obj.listv,,LISTV_Titles!,mem)
71 if bguiwinopen(a)=0 then bguierror(12) else nop
72 id=0
73 do while bguiwinwaitevent(a,'ID')~=id.winclose
74 select
75 when id=id.winactive then nop
76 when id=id.wininactive then nop
77 when id=id.quit then leave
78 when id=id.winclose then nop
79 otherwise nop
80 end
81 end
82 call bguiclose()
83 exit 0
85 syntax:
86 if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl; else nop
87 call bguiclose()
88 exit 10
90 break_c:
91 halt:
92 rc=0
93 say '+++ Break at line' sigl
94 call bguiclose()
95 exit 10