delint: unused on AROS
[AROS-Contrib.git] / bgui / RexxBGUI / bguishowdir.awebrx
blobd1d672441fbd39cf30e9ac9f29cddb94a025ed38
1 /* REXX */
3 'GET SCREEN VAR scr'
4 'GET SELECTION VAR sel'
5 IF rc>0 THEN sel=''
6 sel=strip(sel)
7 dir='Work:TEMP/'sel
8 if right(dir,1)~='/' & right(dir,1)~=':' then dir=dir'/'; else nop
9 address command 'list >t:list' dir 'LFORMAT "%N %L      %D"'
10 address command 'sort t:list t:list2'
12 if ~show('l','rexxbgui.library') then do
13         if ~addlib('rexxbgui.library',0,-30) then do
14                 exit(20)
15         end
16         else nop
17 end
18 else nop
20 call bguiopen('AWebShowDir')
22 call bguireadentries('t:list2','LST')
24 address command 'delete >NIL: t:list t:list2'
26 signal on syntax /* important: bguiclose() MUST be called */
27 signal on halt
28 signal on break_c
30 esc='1B'x
31 lf='0A'x
32 cr='0D'x
33 tab='09'x
34 grspace.narrow=-1
35 grspace.normal=-2
36 grspace.wide=-3
38 g=bguivgroup(,
39         bguilistview('listv',,'LST','S',3 90 20 20)||,
40         bguihgroup(,
41                 bguibutton('del','_Delete')||,
42                 bguivarspace(50)||,
43                 bguibutton('quit','_Quit'),
44         )||bguilayout(LGO_FixMinHeight,1),
45 ,grspace.normal,grspace.normal)
47 call bguiset(obj.del,,GA_Disabled,1)
49 a=bguiwindow('Directory "'sel'" locally ('dir')',g,55,80,,scr)
51 if bguiwinopen(a)=0 then bguierror(12) else nop
53 id=0
54 do while bguiwinwaitevent(a,'ID')~=id.winclose
55         select
56                 when id=id.listv then call bguiset(obj.del,a,GA_Disabled,0)
57                 when id=id.del then do
58                         parse value bguiget(obj.listv,LISTV_LastClicked) with,
59                                 file (tab) /* bug fixed */
60                         fname=dir||file
61                         if bguireq('Delete' fname'?','*_Yes|_No',,a)=1 then do
62                                 address command 'delete >nil:' fname
63                                 if rc=0 then do
64                                         call bguilistvcommand(obj.listv,a,'remselected')
65                                 end; else do
66                                         call bguireq('Unable to delete!','*_OK',,a)
67                                 end
68                         end; else nop
69                 end
70                 when id=id.quit then leave
71                 when id=id.winclose then nop
72                 otherwise nop
73         end
74 end
75 rc=0
77 syntax:
78 if rc~=0 then address aweb.1 'request Error "' '+++ ['rc']' errortext(rc) 'at line' sigl '" "_Abort"'
79 call bguiclose()
80 exit 10
82 break_c:
83 halt:
84 rc=0
85 address aweb.1 'request Error "' '+++ Break at line' sigl '" "_Abort"'
86 call bguiclose()
87 exit 10