home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / dock.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  3.1 KB  |  111 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call CreateApp
  7. call HandleApp
  8. /* never reached */
  9. /***********************************************************************/
  10. init: procedure expose global.
  11.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  12.     if AddLibrary("rxmui.library")~=0 then exit
  13.     call RxMUIOpt("debugmode showerr")
  14.     return
  15. /***********************************************************************/
  16. CreateApp: procedure
  17.  
  18.     app.Title="DockDemo"
  19.     app.Version="$VER: DockDemo 1.0 (4.2.2001)"
  20.     app.Copyright="©2001, alfie"
  21.     app.Author="alfie"
  22.     app.Description="DockDemo"
  23.     app.Base="DOCKDEMO"
  24.     app.SubWindow="win"
  25.      win.ID="MAIN"
  26.      win.AppWindow=1
  27.      win.Title="DockDemo"
  28.      win.Contents="mgroup"
  29.  
  30.       mgroup.0="g"
  31.        g.class="group"
  32.        g.spacing=0
  33.        g.horiz=1
  34.         g.0=CreateDock(1,1)
  35.  
  36.       mgroup.1=MakeObj(,"HBar")
  37.  
  38.        ni.Format="1b63"x || "  Icons: %ld  "
  39.       mgroup.2=MakeObj("ni","numericbutton",,1,10)
  40.  
  41.     res=NewObj("APPLICATION","APP")
  42.     if res~=0 then call err(res)
  43.  
  44.     call Notify("win","CloseRequest",1,"app","ReturnID","quit")
  45.     call Notify("ni","value","everytime","app","Return","call CreateDock(h.value,0)","triggerattr")
  46.     call IconNotify(1)
  47.     call set("win","open",1)
  48.     call getattr("win","open","o")
  49.     if o=0 then do
  50.         say "can't open window"
  51.         exit
  52.     end
  53.  
  54.     return
  55. /**************************************************************************/
  56. CreateDock: procedure expose global.
  57. parse arg ni,init
  58.     if ~init then do
  59.         call DoMethod("g","InitChanges")
  60.         call Dispose("dock")
  61.     end
  62.     dock.horiz=1
  63.     if NewObj("group","dock")<0 then exit
  64.     do i=1 to ni
  65.         ic.class="icon"
  66.         ic.name="sys:disk"
  67.         ic.inputmode="relverify"
  68.         ic.frame="button"
  69.         name="icon"i
  70.         if NewObj("icon",name,"ic")<0 then exit
  71.         call Add("dock",name)
  72.     end
  73.     call Add("dock",hspace())
  74.     if ~init then do
  75.         call Add("g","dock")
  76.         call DoMethod("g","ExitChanges")
  77.         call IconNotify(ni)
  78.     end
  79.     return "dock"
  80. /**************************************************************************/
  81. IconNotify: procedure expose global.
  82. parse arg ni
  83.     do i=1 to ni
  84.         call Notify("icon"i,"pressed",0,"app","return","say icon" i "pressed")
  85.         call AppMessage("icon"i)
  86.     end
  87.     return
  88. /**************************************************************************/
  89. HandleApp: procedure
  90.     ctrl_c=2**12
  91.     do forever
  92.         call NewHandle("app","h",ctrl_c)
  93.         if and(h.signals,ctrl_c)>0 then exit
  94.         select
  95.             when h.event="QUIT" then exit
  96.             when h.event="APPEVENT" then call AppFun(h.to,h.name)
  97.             otherwise interpret h.event
  98.         end
  99.     end
  100.     /* never reached */
  101. /***********************************************************************/
  102. AppFun: procedure
  103.     parse arg to,name
  104.     say "Dropped" name "to" to
  105.     return
  106. /**************************************************************************/
  107. halt:
  108. break_c:
  109.     exit
  110. /**************************************************************************/
  111.