home *** CD-ROM | disk | FTP | other *** search
- /**/
-
- signal on halt
- signal on break_c
-
- call init
- call CreateApp
- call handleApp
- /* never reached */
- /***********************************************************************/
- init: procedure expose global.
- l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
- if AddLibrary("rxmui.library")~=0 then exit
-
- call RxMUIOpt("showerr debugmode")
-
- global.idx=0
-
- global.background.0="BACKGROUND"
- global.background.1="SHADOW"
- global.background.2="SHINE"
- global.background.3="FILL"
- global.background.4="SHADOWBACK"
- global.background.5="SHADOWFILL"
- global.background.6="SHADOWSHINE"
- global.background.7="FILLBACK"
- global.background.8="FILLSHINE"
- global.background.9="SHINEBACK"
- global.background.10="FILLBACK2"
- global.background.11="HSHINEBACK"
- global.background.12="HSHADOWBACK"
- global.background.13="HSHINESHINE"
- global.background.14="HSHADOWSHADOW"
- global.background.14="MARKSHINE"
- global.background.15="MARKHALFSHINE"
- global.background.16="MARKBACKGROUND"
-
- call randu(time(s)) /* init seed */
-
- return
- /***********************************************************************/
- CreateApp: procedure expose global.
-
- app.Title="Better Balancing"
- app.Version="$VER: BetterBalancing 1.2 (30.4.2001)"
- app.Copyright="©2001, alfie"
- app.Author="alfie"
- app.Description="Better Balancing example"
- app.Base="BALANCING"
- app.DiskObject="sendmsg"
- app.SubWindow="win"
-
- win.ID="MAIN"
- win.Title="Balancing"
- win.width=-250
- win.height=-250
- win.Contents="mgroup"
-
- mgroup.class="group"
- mgroup.horiz=1
-
- call child("mgroup","g0","group")
- g0.frame="group"
- g0.weight=15
- g0.0=rect("text",50)
- g0.1=rect("text",100)
- g0.2=MakeBetterBalanceObj()
- g0.3=rect("text",200)
-
- call child("mgroup",MakeBetterBalanceObj())
-
- call child("mgroup","g1","group")
- g1.frame="group"
- call child("g1","g10","group")
- g10.horiz=1
- g10.0=rect("text",,1)
- g10.1=MakeBetterBalanceObj()
- g10.2=rect("text",,1)
- call child("g1","g11","group")
- g11.horiz=1
- g11.0=rect("text")
- g11.1=MakeBetterBalanceObj()
- g11.2=rect("text")
- g11.3=MakeBetterBalanceObj()
- g11.4=rect("text")
- g11.5=MakeBetterBalanceObj()
- g11.6=rect("text")
- g11.7=MakeBetterBalanceObj()
- g11.8=rect("text")
- call child("g1","g12","group")
- g12.horiz=1
- g12.frame="group"
- call child("g12","g120","group")
- g120.horiz=1
- g120.0=rect("text")
- g120.1=MakeBetterBalanceObj()
- g120.2=rect("text")
- call child("g12",MakeBetterBalanceObj())
- call child("g12","g121","group")
- g121.horiz=1
- g121.0=rect("text")
- g121.1=MakeBetterBalanceObj()
- g121.2=rect("text")
- call child("g1","g13","group")
- g13.horiz=1
- g13.frame="group"
- g13.0=rect("text",50)
- g13.1=rect("text",100)
- g13.2=MakeBetterBalanceObj()
- g13.3=rect("text",200)
- call child("g1","g14","group")
- g14.horiz=1
- g14.frame="group"
- g14.0=button("also","Also")
- g14.1=MakeBetterBalanceObj()
- g14.2=button("try","Try")
- g14.3=MakeBetterBalanceObj()
- g14.4=button("sizing","Sizing")
- g14.5=MakeBetterBalanceObj()
- g14.6=button("with","With")
- g14.7=MakeBetterBalanceObj()
- g14.8=button("shift","Shift")
- call child("g1","g15","group")
- g15.horiz=1
- g15.frame="group"
- g15.0=label("Label 1:")
- g15.1=text("data","data...")
- g15.2=MakeBetterBalanceObj()
- g15.3=label("Label 2:")
- g15.4=text("more","more data...")
-
- if NewObj("APPLICATION","APP")>0 then exit
-
- call Notify("WIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
-
- call DoMethod("App","Load","Env")
- call set("win","defaultobject",mgroup.1)
-
- call set("win","open",1)
- if ~xget("win","open") then do
- say "can't open window"
- exit
- end
-
- return
- /**************************************************************************/
- handleApp: procedure
- do forever
- call newhandle("APP","H",2**12)
- if and(h.signals,2**12)>0 then exit
- select
- when h.event="QUIT" then do
- call DoMethod("App","Save","Env")
- exit
- end
- otherwise nop
- end
- end
- /* never reached */
- /***********************************************************************/
- halt:
- break_c:
- exit
- /**************************************************************************/
- rect: procedure expose global.
- parse arg f,w,putid
- name="rect"global.idx
-
- if f~="" then rec.frame=f
- if w~="" then rec.weight=w
- if putid~="" then rec.objectid=global.idx
-
- i=random(0,17)
- rec.background=global.background.i
-
- global.idx=global.idx+1
-
- res=NewObj("rectangle",name,"rec")
- if res~=0 then call err(res)
- return name
- /**************************************************************************/
- MakeBetterBalanceObj: procedure expose global.
- o=MakeObj(,"BetterBalance",global.idx)
- global.idx=global.idx+1
- return o
- /**************************************************************************/
-