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

  1. /**/
  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("rxmui.library")~=0 then exit
  14.  
  15.     call RxMUIOpt("showerr debugmode")
  16.  
  17.     global.idx=0
  18.  
  19.     global.background.0="BACKGROUND"
  20.     global.background.1="SHADOW"
  21.     global.background.2="SHINE"
  22.     global.background.3="FILL"
  23.     global.background.4="SHADOWBACK"
  24.     global.background.5="SHADOWFILL"
  25.     global.background.6="SHADOWSHINE"
  26.     global.background.7="FILLBACK"
  27.     global.background.8="FILLSHINE"
  28.     global.background.9="SHINEBACK"
  29.     global.background.10="FILLBACK2"
  30.     global.background.11="HSHINEBACK"
  31.     global.background.12="HSHADOWBACK"
  32.     global.background.13="HSHINESHINE"
  33.     global.background.14="HSHADOWSHADOW"
  34.     global.background.14="MARKSHINE"
  35.     global.background.15="MARKHALFSHINE"
  36.     global.background.16="MARKBACKGROUND"
  37.  
  38.     call randu(time(s)) /* init seed */
  39.  
  40.     return
  41. /***********************************************************************/
  42. CreateApp: procedure expose global.
  43.  
  44.     app.Title="Better Balancing"
  45.     app.Version="$VER: BetterBalancing 1.2 (30.4.2001)"
  46.     app.Copyright="©2001, alfie"
  47.     app.Author="alfie"
  48.     app.Description="Better Balancing example"
  49.     app.Base="BALANCING"
  50.     app.DiskObject="sendmsg"
  51.     app.SubWindow="win"
  52.  
  53.      win.ID="MAIN"
  54.      win.Title="Balancing"
  55.      win.width=-250
  56.      win.height=-250
  57.      win.Contents="mgroup"
  58.  
  59.       mgroup.class="group"
  60.       mgroup.horiz=1
  61.  
  62.        call child("mgroup","g0","group")
  63.         g0.frame="group"
  64.         g0.weight=15
  65.         g0.0=rect("text",50)
  66.         g0.1=rect("text",100)
  67.         g0.2=MakeBetterBalanceObj()
  68.         g0.3=rect("text",200)
  69.  
  70.        call child("mgroup",MakeBetterBalanceObj())
  71.  
  72.        call child("mgroup","g1","group")
  73.         g1.frame="group"
  74.         call child("g1","g10","group")
  75.          g10.horiz=1
  76.          g10.0=rect("text",,1)
  77.          g10.1=MakeBetterBalanceObj()
  78.          g10.2=rect("text",,1)
  79.         call child("g1","g11","group")
  80.          g11.horiz=1
  81.          g11.0=rect("text")
  82.          g11.1=MakeBetterBalanceObj()
  83.          g11.2=rect("text")
  84.          g11.3=MakeBetterBalanceObj()
  85.          g11.4=rect("text")
  86.          g11.5=MakeBetterBalanceObj()
  87.          g11.6=rect("text")
  88.          g11.7=MakeBetterBalanceObj()
  89.          g11.8=rect("text")
  90.         call child("g1","g12","group")
  91.          g12.horiz=1
  92.          g12.frame="group"
  93.          call child("g12","g120","group")
  94.           g120.horiz=1
  95.            g120.0=rect("text")
  96.            g120.1=MakeBetterBalanceObj()
  97.            g120.2=rect("text")
  98.          call child("g12",MakeBetterBalanceObj())
  99.          call child("g12","g121","group")
  100.           g121.horiz=1
  101.            g121.0=rect("text")
  102.            g121.1=MakeBetterBalanceObj()
  103.            g121.2=rect("text")
  104.         call child("g1","g13","group")
  105.          g13.horiz=1
  106.          g13.frame="group"
  107.           g13.0=rect("text",50)
  108.           g13.1=rect("text",100)
  109.           g13.2=MakeBetterBalanceObj()
  110.           g13.3=rect("text",200)
  111.         call child("g1","g14","group")
  112.          g14.horiz=1
  113.          g14.frame="group"
  114.           g14.0=button("also","Also")
  115.           g14.1=MakeBetterBalanceObj()
  116.           g14.2=button("try","Try")
  117.           g14.3=MakeBetterBalanceObj()
  118.           g14.4=button("sizing","Sizing")
  119.           g14.5=MakeBetterBalanceObj()
  120.           g14.6=button("with","With")
  121.           g14.7=MakeBetterBalanceObj()
  122.           g14.8=button("shift","Shift")
  123.         call child("g1","g15","group")
  124.          g15.horiz=1
  125.          g15.frame="group"
  126.           g15.0=label("Label 1:")
  127.           g15.1=text("data","data...")
  128.           g15.2=MakeBetterBalanceObj()
  129.           g15.3=label("Label 2:")
  130.           g15.4=text("more","more data...")
  131.  
  132.     if NewObj("APPLICATION","APP")>0 then exit
  133.  
  134.     call Notify("WIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
  135.  
  136.     call DoMethod("App","Load","Env")
  137.     call set("win","defaultobject",mgroup.1)
  138.  
  139.     call set("win","open",1)
  140.     if ~xget("win","open") then do
  141.         say "can't open window"
  142.         exit
  143.     end
  144.  
  145.     return
  146. /**************************************************************************/
  147. handleApp: procedure
  148.     do forever
  149.         call newhandle("APP","H",2**12)
  150.         if and(h.signals,2**12)>0 then exit
  151.         select
  152.             when h.event="QUIT" then do
  153.                    call DoMethod("App","Save","Env")
  154.                 exit
  155.             end
  156.             otherwise nop
  157.         end
  158.     end
  159.     /* never reached */
  160. /***********************************************************************/
  161. halt:
  162. break_c:
  163.     exit
  164. /**************************************************************************/
  165. rect: procedure expose global.
  166. parse arg f,w,putid
  167.     name="rect"global.idx
  168.  
  169.     if f~="" then rec.frame=f
  170.     if w~="" then rec.weight=w
  171.     if putid~="" then rec.objectid=global.idx
  172.  
  173.     i=random(0,17)
  174.     rec.background=global.background.i
  175.  
  176.     global.idx=global.idx+1
  177.  
  178.     res=NewObj("rectangle",name,"rec")
  179.     if res~=0 then call err(res)
  180.     return name
  181. /**************************************************************************/
  182. MakeBetterBalanceObj: procedure expose global.
  183.     o=MakeObj(,"BetterBalance",global.idx)
  184.     global.idx=global.idx+1
  185.     return o
  186. /**************************************************************************/
  187.