home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / AddRem.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  2.9 KB  |  94 lines

  1. /* Add/Remove example */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init
  7. call CreateApp
  8. call HandleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure expose global.
  12.     l="rmh.library";if ~show("L",l) then;if ~AddLib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     return
  15. /***********************************************************************/
  16. CreateApp: procedure expose global.
  17.  
  18.     app.title="AddRem"
  19.     app.version="$VER: AddRem 1.0 (20.7.2000)"
  20.     app.copyright="Copyright 2000 by Alfie"
  21.     app.author="alfie"
  22.     app.description="Show object hiding."
  23.     app.base="ADDREM"
  24.     app.SubWindow="mwin"
  25.  
  26.      mwin.ID="MAIN"
  27.      mwin.title="Add & Rem"
  28.      mwin.contents="mgroup"
  29.  
  30.       call child("mgroup","g0","group")
  31.        g0.frame="group"
  32.  
  33.         call child("g0","g00","group")
  34.          g00.horiz=1
  35.          g00.weight=0
  36.           g00.0=hspace(0)
  37.           g00.1=CheckMark("c0",1)
  38.           g00.2=CheckMark("c1",1)
  39.           g00.3=CheckMark("c2",1)
  40.           g00.4=CheckMark("c3",1)
  41.           g00.5=CheckMark("c4",1)
  42.           g00.6=hspace(0)
  43.  
  44.         call child("g0","g01","group")
  45.           g01.0=button("b0","Button 1")
  46.           g01.1=button("b1","Button 2")
  47.           g01.2=button("b2","Button 3")
  48.           g01.3=button("b3","Button 4")
  49.           g01.4=button("b4","Button 5")
  50.           g01.5=VSpace(0)
  51.  
  52.     res=NewObj("application","app")
  53.     if res~=0 then exit
  54.  
  55.     call notify("mwin","CloseRequest",1,"app","ReturnID","quit")
  56.     call notify("c0","selected","EveryTime","app","Return","call addRemFun(0,h.selected)","TriggerAttr")
  57.     call notify("c1","selected","EveryTime","app","Return","call addRemFun(1,h.selected)","TriggerAttr")
  58.     call notify("c2","selected","EveryTime","app","Return","call addRemFun(2,h.selected)","TriggerAttr")
  59.     call notify("c3","selected","EveryTime","app","Return","call addRemFun(3,h.selected)","TriggerAttr")
  60.     call notify("c4","selected","EveryTime","app","Return","call addRemFun(4,h.selected)","TriggerAttr")
  61.  
  62.     call set("mwin","open",1)
  63.  
  64.     return
  65. /***********************************************************************/
  66. HandleApp: procedure  expose global.
  67.     ctrl_c=2**12
  68.     do forever
  69.         call NewHandle("APP","H",ctrl_c)
  70.         if and(h.signals,ctrl_c)>0 then exit
  71.         select
  72.             when h.event="QUIT" then exit
  73.             otherwise interpret h.event
  74.         end
  75.     end
  76.     /* never reached */
  77. /***********************************************************************/
  78. addRemFun: procedure expose global.
  79. parse arg num,sel
  80.     call DoMethod("g01","InitChange")
  81.     if sel then do
  82.         call Add("g01","b" || num)
  83.     end
  84.     else do
  85.         call Remove("b" || num)
  86.     end
  87.     call DoMethod("g01","ExitChange")
  88.     return
  89. /**************************************************************************/
  90. halt:
  91. break_c:
  92.     exit
  93. /**************************************************************************/
  94.