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

  1. /* Cute one: all is done via MakeObj() calls */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call handleApp
  9.  
  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.     global.left=1
  15.     global.right=1
  16.     return
  17. /***********************************************************************/
  18. CreateApp: procedure expose global.
  19.  
  20.     app.Title="Slidorama"
  21.     app.Version="$VER: Slidorama 2.0 (26.2.2002)"
  22.     app.Copyright="©1999-2002 alfie"
  23.     app.Author="alfie"
  24.     app.Description="Slidorama example"
  25.     app.Base="EXAMPLE"
  26.     app.menustrip=MakeObj(,"menustrip",,
  27.                     MakeObj(,"menu","Project",,
  28.                         menuitem("mabout","?\About..."),,
  29.                         menuitem("maboutrxmui","X\About RxMUI..."),,
  30.                         menuitem("maboutmui","!\About MUI..."),,
  31.                         menuitem(,"BAR"),,
  32.                         menuitem("mhide","H\Hide"),,
  33.                         menuitem(,"BAR"),,
  34.                         menuitem("mquit","Q\Quit")),,
  35.                     MakeObj("medit","menu","Editor",,
  36.                         MakeObj(,"MenuItem",menuitem(,"Show"),,
  37.                             menuitem("mshowall","Show all",,"CHECKED CHEKIT TOGGLE",6),,
  38.                             menuitem("mshowleft","Show left",,"CHEKIT TOGGLE",5),,
  39.                             menuitem("mshowright","Show right",,"CHEKIT TOGGLE",3)),,
  40.                         menuitem(,"BAR"),,
  41.                         menuitem("mmui","M\MUI...")))
  42.  
  43.  
  44.     app.SubWindow="win"
  45.      win.ID="MAIN"
  46.      win.Title="Slidorama"
  47.  
  48.      sl.Stringify="parse arg v;if v=0 then return ' You''re kidding! '; if v<40 then return v 'points. :-(';if v<61 then return v 'points. :-|';if v=100 then return ' It''s magic! '; return v 'points. :-)'"
  49.  
  50.      win.Contents=,
  51.         MakeObj("mgroup","VGroup",,
  52.             MakeObj("hgroup","HGroup",,
  53.                 MakeObj("left","HFrameGroup","Knobs",,
  54.                     MAkeObj(,"HCenter",,
  55.                         MAkeObj(,"VCenter",,
  56.                             MakeObj(,"ColGroup",2,,
  57.                                 Label("Volume:"),,
  58.                                 MakeObj(,"HGroup",,
  59.                                     MakeObj(,"Knob",,0,64,64),,
  60.                                     MakeObj(,"Knob",,0,64,64),,
  61.                                     MakeObj(,"Knob",,0,64,64),,
  62.                                     MakeObj(,"Knob",,0,64,64)),,
  63.                                 Label("Bass:"),,
  64.                                 MakeObj(,"HGroup",,
  65.                                     MakeObj(,"Knob",,-100,100,0),,
  66.                                     MakeObj(,"Knob",,-100,100,0),,
  67.                                     MakeObj(,"Knob",,-100,100,0),,
  68.                                     MakeObj(,"Knob",,-100,100,0)),,
  69.                                 Label("Treble:"),,
  70.                                 MakeObj(,"HGroup",,
  71.                                     MakeObj(,"Knob",,-100,100,0),,
  72.                                     MakeObj(,"Knob",,-100,100,0),,
  73.                                     MakeObj(,"Knob",,-100,100,0),,
  74.                                     MakeObj(,"Knob",,-100,100,0)))))),,
  75.                 MakeObj("right","VGroup",,
  76.                     MakeObj(,"HFrameGroup","Levelmeter Displays",,
  77.                         MakeObj(,"HCenter",,
  78.                             MAkeObj(,"VCenter",,
  79.                                 MakeObj(,"HGroup",,
  80.                                     MakeObj("lm1","Levelmeter",,,,,"Horizontal"),,
  81.                                     MakeObj("lm2","Levelmeter",,,,,"Vertical"),,
  82.                                     MakeObj("lm3","Levelmeter",,,,,"Total"))))),,
  83.                     MakeObj(,"HFrameGroup","Numeric Buttons",,
  84.                         MakeObj(,"HCenter",,
  85.                             MakeObj(,"ColGroup",2,,
  86.                                 Label("Low:"),,
  87.                                 MakeObj(,"HGroup",,
  88.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  89.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  90.                                     MakeObj(,"NumericButton",,,,,"%ld %%")),,
  91.                                 Label("Mid:"),,
  92.                                 MakeObj(,"HGroup",,
  93.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  94.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  95.                                     MakeObj(,"NumericButton",,,,,"%ld %%")),,
  96.                                 Label("High:"),,
  97.                                 MakeObj(,"HGroup",,
  98.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  99.                                     MakeObj(,"NumericButton",,,,,"%ld %%"),,
  100.                                     MakeObj(,"NumericButton",,,,,"%ld %%"))))))),,
  101.             MakeObj(,"HGroup",,
  102.                 Label("Slidorama Rating:"),,
  103.                 MakeObj("sl","Slider")))
  104.  
  105.     res=NewObj("application","app")
  106.     if res~=0 then exit
  107.  
  108.     call Notify("win","closerequest",1,"_app","returnid","quit")
  109.     call Notify("mabout","menutrigger","everytime","_app","about","win")
  110.     call Notify("maboutrxmui","menutrigger","everytime","_app","aboutrxmui","win")
  111.     call Notify("maboutmui","menutrigger","everytime","_app","aboutmui","win")
  112.     call Notify("mhide","menutrigger","everytime","_app","set","iconified",1)
  113.     call Notify("mquit","menutrigger","everytime","_app","returnid","quit")
  114.     call Notify("mshowall","checked",1,"app","return","call ShowFun('ALL')")
  115.     call Notify("mshowleft","checked",1,"app","return","call ShowFun('LEFT')")
  116.     call Notify("mshowright","checked",1,"app","return","call ShowFun('RIGHT')")
  117.     call Notify("mmui","menutrigger","everytime","_app","openconfigwindow")
  118.  
  119.     call Notify("sl","value","EveryTime","lm1","set","value","triggervalue")
  120.     call Notify("sl","value","EveryTime","lm2","set","value","triggervalue")
  121.     call Notify("sl","value","EveryTime","lm3","set","value","triggervalue")
  122.  
  123.     call set("lm2","Reverse",1)
  124.  
  125.     call set("win","open",1)
  126.  
  127.     return
  128. /**************************************************************************/
  129. handleApp: procedure expose global.
  130.     ctrl_c=2**12
  131.     do forever
  132.         call NewHandle("app","h",ctrl_c)
  133.         if and(h.signals,ctrl_c)>0 then exit
  134.         select
  135.             when h.event="QUIT" then exit
  136.             otherwise interpret h.event
  137.         end
  138.     end
  139. /***********************************************************************/
  140. halt:
  141. break_c:
  142.     exit
  143. /**************************************************************************/
  144. ShowFun: procedure expose global.
  145. parse arg what
  146.     call DoMethod("hgroup","InitChange")
  147.     select
  148.         when what="LEFT" then do
  149.             if global.right then call Remove("right")
  150.             if ~global.left then call Add("hgroup","left")
  151.             global.left=1
  152.             global.right=0
  153.         end
  154.         when what="RIGHT" then do
  155.             if global.left then call Remove("left")
  156.             if ~global.right then call Add("hgroup","right")
  157.             global.left=0
  158.             global.right=1
  159.         end
  160.         otherwise do
  161.             if ~global.left then do
  162.                 call Add("hgroup","left")
  163.                 sort=1
  164.             end
  165.             else sort=0
  166.             if ~global.right then call Add("hgroup","right")
  167.             if sort then call DoMethod("hgroup","sort","left","right")
  168.             global.left=1
  169.             global.right=1
  170.         end
  171.     end
  172.     call DoMethod("hgroup","ExitChange")
  173.     return
  174. /**************************************************************************/
  175.