home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 109
/
EnigmaAmiga109CD.iso
/
software
/
sviluppo
/
rxmui
/
examples
/
tutorial2.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-12-21
|
5KB
|
156 lines
/**/
signal on halt
signal on break_c
/* first of all add the needed libraries */
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
if AddLibrary("rxmui.library")~=0 then exit
/* create the application */
call createApp
/* open the window and check if it is */
call set("win","open",1)
call getattr("win","open","o")
if o=0 then do
say "can't open window"
exit
end
/* handle the application */
call handleApp
exit
/***********************************************************************/
handleApp: procedure
/* this is the standard cycle to handle an application */
ctrl_C=2**12
s=0
do forever
call handle("APP","H",s)
do i=0 to h.num-1
id=h.i
select
when id="QUIT" then exit
otherwise say h.i
end
end
s=wait(or(h.signals,ctrl_C))
if and(s,ctrl_C)~=0 then exit
end
/* never reached */
/***********************************************************************/
err: procedure expose sigl rxmuierror
parse arg res
say sigl "["res"]"
say getrxmuistring(res) "in line" sigl-1 rxmuierror
exit
/***********************************************************************/
createApp: procedure
/* first of all the let's create the menu strip
* here made only of one item "Project"
*/
strip.0="mproject"
mproject.Title="Project"
mproject.class="menu"
mproject.0=menuitem("mabout","About...","?")
mproject.1=menuitem("maboutrxmui","About RxMUI...")
mproject.2=menuitem("maboutmui","About MUI...")
mproject.3=menuitem("","BAR")
mproject.4=menuitem("mhide","Hide","H")
mproject.5=menuitem("","BAR")
mproject.6=menuitem("mquit","Quit","Q")
res=NewObj("menustrip","strip")
if res~=0 then call err(res)
/* with one NewObj() call we create many objects */
/* first of all the let's define the application object */
app.Title="Tutorial2"
app.Version="$VER: Tutorial2 1.0 (10.12.99)"
app.Copyright="©1999, alfie"
app.Author="alfie"
app.Description="Just a little example"
app.Base="EXAMPLE"
app.diskobject="rxmui"
app.ctrlc=1
app.menustrip="strip"
app.subwindow="win"
/* let's define the window */
win.ID="MAIN"
win.Title="A Tutorial"
win.Contents="mgroup"
/* let's define the window contents */
mgroup.0="dg"
dg.class="group"
dg.frame="group"
dg.columns=2
dg.0=label("_Name");
dg.1=String("name",'n')
dg.2=label("Age");
dg.3="ag"
ag.class="group"
ag.horiz=1
ag.horizspacing=0
ag.0="age";age.class="numericbutton";age.min=0;age.max=150;age.value=30
ag.1=hspace()
dg.4=label("_Sex")
dg.5="sg"
sg.class="group"
sg.horiz=1
sg.0="sex";sex.controlchar="s";sex.class="radio";sex.entries="Male|Female";sex.horiz=1
sg.1=hvspace()
dg.6=label("_Knowledge");dg.7="known";known.class="cycle";known.controlchar="k";known.entries="Novice|Average|Good|Exepert"
dg.8=label("Language(s)")
dg.9="lg"
lg.class="group"
lg.horiz=1
lg.0=checkmark("BASIC",,'b');lg.1=label("_Basic");lg.2=hspace(5)
lg.3=checkmark("ARexx",,'a');lg.4=label("_ARexx");lg.5=hspace(5)
lg.6=checkmark("C",,'c');lg.7=label("_C");lg.8=hspace(5)
lg.9=checkmark("ASM",,'m');lg.10=label("AS_M");lg.11=hvspace()
mgroup.1="bg"
bg.class="group"
bg.columns=3
bg.0=Button("RESET","_Reset Form")
bg.1=Button("DONE","_Done")
bg.2=Button("CANCEL","Cance_l")
/* create all */
call NewObj("APPLICATION","APP")
/* window close gadget means quit */
call Notify("WIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
/* done gadget should do something else, anyway means quit */
call Notify("done","pressed",0,"APP","RETURNID","QUIT")
/* cancel gadget means quit */
call Notify("cancel","pressed",0,"APP","RETURNID","QUIT")
/* about menuitem means show the automatic about requester */
call Notify("mabout","menutrigger","everytime","app","about","win")
/* aboutrxmui menuitem means show the rxmui about requester */
call Notify("maboutrxmui","menutrigger","everytime","app","aboutrxmui","win")
/* aboutmui menuitem means show the about MUI window */
call Notify("maboutmui","menutrigger","everytime","app","aboutmui","win")
/* hide menuitem means hide all windows (just one here) */
call Notify("mhide","menutrigger","everytime","app","set","iconified",1)
/* quit menu item means quit */
call Notify("mquit","menutrigger","everytime","app","returnid","quit")
call set("win","activeobject","done")
return
/***********************************************************************/
halt:
break_c:
exit
/**************************************************************************/