home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / bal.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  4.9 KB  |  178 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="Balancing"
  45.     app.Version="$VER: Balancing 1.1 (16.3.2001)"
  46.     app.Copyright="©2001, alfie"
  47.     app.Author="alfie"
  48.     app.Description="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=MakeObj(,"balance")
  68.         g0.3=rect("text",200)
  69.  
  70.        call child("mgroup",MakeObj(,"balance"))
  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=MakeObj(,"balance")
  78.          g10.2=rect("text",,1)
  79.         call child("g1","g11","group")
  80.          g11.horiz=1
  81.          g11.0=rect("text")
  82.          g11.1=MakeObj(,"balance")
  83.          g11.2=rect("text")
  84.          g11.3=MakeObj(,"balance")
  85.          g11.4=rect("text")
  86.          g11.5=MakeObj(,"balance")
  87.          g11.6=rect("text")
  88.          g11.7=MakeObj(,"balance")
  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=MakeObj(,"balance")
  97.            g120.2=rect("text")
  98.          call child("g12",MakeObj(,"balance"))
  99.          call child("g12","g121","group")
  100.           g121.horiz=1
  101.            g121.0=rect("text")
  102.            g121.1=MakeObj(,"balance")
  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=MakeObj(,"balance")
  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=MakeObj(,"balance")
  116.           g14.2=button("try","Try")
  117.           g14.3=MakeObj(,"balance")
  118.           g14.4=button("sizing","Sizing")
  119.           g14.5=MakeObj(,"balance")
  120.           g14.6=button("with","With")
  121.           g14.7=MakeObj(,"balance")
  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=MakeObj(,"balance")
  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 set("win","defaultobject",mgroup.1)
  137.  
  138.     call set("win","open",1)
  139.     if ~xget("win","open") then do
  140.         say "can't open window"
  141.         exit
  142.     end
  143.  
  144.     return
  145. /**************************************************************************/
  146. handleApp: procedure
  147.     do forever
  148.         call newhandle("APP","H",2**12)
  149.         if and(h.signals,2**12)>0 then exit
  150.         select
  151.             when h.event="QUIT" then exit
  152.             otherwise nop
  153.         end
  154.     end
  155.     /* never reached */
  156. /***********************************************************************/
  157. halt:
  158. break_c:
  159.     exit
  160. /**************************************************************************/
  161. rect: procedure expose global.
  162. parse arg f,w,putid
  163.     name="rect"global.idx
  164.  
  165.     if f~="" then rec.frame=f
  166.     if w~="" then rec.weight=w
  167.     if putid~="" then rec.objectid=global.idx
  168.  
  169.     i=random(0,17)
  170.     rec.background=global.background.i
  171.  
  172.     global.idx=global.idx+1
  173.  
  174.     res=NewObj("rectangle",name,"rec")
  175.     if res~=0 then call err(res)
  176.     return name
  177. /**************************************************************************/
  178.