home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 19 / AACD19.BIN / AACD / Programming / rxmui / examples / envbrowser.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-01-29  |  2.7 KB  |  104 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  7. if AddLibrary("rxmui.library")~=0 then exit
  8.  
  9. global.idx=0
  10. call createApp
  11.  
  12. call set("mwin","open",1)
  13. call getattr("mwin","open","o")
  14. if o=0 then do
  15.     say "can't open window"
  16.     exit
  17. end
  18.  
  19. call handleApp
  20. exit
  21. /***********************************************************************/
  22. handleApp: procedure  expose global.
  23.     ctrl_c=2**12
  24.     do forever
  25.         call NewHandle("APP","H",ctrl_c)
  26.         if and(h.signals,ctrl_c)>0 then exit
  27.         select
  28.  
  29.             when h.event="QUIT" then exit
  30.  
  31.             when h.event="PARENT" then do
  32.                 call getattr("dlist","directory","P")
  33.                 call set("dlist","directory",pathpart(p))
  34.             end
  35.  
  36.             when h.event="DOUBLE" then do
  37.                 call getattr("dlist","Path","P")
  38.                 if word(statef(p),1)="DIR" then call set("dlist","directory",p)
  39.             end
  40.  
  41.             when h.event="DISPLAY" then do
  42.                 call getattr("dlist","Path","P")
  43.                 if word(statef(p),1)~="DIR" then cont=ReadFile(p)
  44.                 else cont=""
  45.                 call set("elcont","contents",cont)
  46.             end
  47.  
  48.             otherwise nop
  49.         end
  50.     end
  51.  
  52. /***********************************************************************/
  53. err: procedure expose sigl RxMUIError
  54. parse arg res
  55.     msg = ProgramName()":" GetRxMUIString(res) "in line" sigl-1
  56.     if RxMUIError~="RXMUIERROR" then msg = msg "["RxMUIError"]"
  57.     say msg
  58.     exit
  59. /***********************************************************************/
  60. createApp: procedure expose global.
  61.  
  62.     app.title="EnvBrowser"
  63.     app.version="$Ver: EnvBrowser 19.5 (20.7.2000)"
  64.     app.copyright="Copyright 2000 by Alfie"
  65.     app.author="alfie"
  66.     app.description="View environment variables."
  67.     app.base="ENVBROWSER"
  68.     app.SubWindow="mwin"
  69.  
  70.      mwin.ID="MAIN"
  71.      mwin.title="Environment Browser"
  72.      mwin.contents="mgroup"
  73.  
  74.       call child("mgroup","elview","listview")
  75.        elview.list="dlist"
  76.         dlist.class="dirlist"
  77.         dlist.frame="inputlist"
  78.         dlist.directory="env:"
  79.  
  80.       call child("mgroup","elcont","textinputscroll")
  81.        elcont.FIXHEIGHTTXT="0a0a0a"x
  82.        elcont.frame="text"
  83.        elcont.multiline=1
  84.        elcont.noinput=1
  85.  
  86.       call child("mgroup",button("parent","_Parent"))
  87.  
  88.     res=NewObj("application","app")
  89.     if res~=0 then call err(res)
  90.  
  91.     call notify("mwin","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
  92.  
  93.     call notify("elview","active","everytime","app","return","DISPLAY")
  94.     call notify("elview","doubleclick","everytime","app","return","DOUBLE")
  95.  
  96.     call notify("parent","pressed",0,"app","returnid")
  97.  
  98.     return
  99. /***********************************************************************/
  100. halt:
  101. break_c:
  102.     exit
  103. /**************************************************************************/
  104.