home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
600-699
/
ff634.lha
/
APIG
/
apig33.lzh
/
newmenus2.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-03-11
|
5KB
|
152 lines
/* Example of hard coding a new menu structure */
/* I imagine you wont be doing much of this */
x = addlib("apig.library",0,-30,0)
portname = "nmex2_port"
p = openport(portname)
call set_apig_globals()
scrtitle = "Hey Buddy, Yea You, This is Your New Screen !"
wintitle = "APIG 3.1 Simple Menu Example"
winidcmp = IDCMP_CLOSEWINDOW+IDCMP_MENUPICK
winflags = WFLG_CLOSEGADGET+WFLG_DEPTHGADGET+WFLG_ACTIVATE
scr = openscreen(0,0,640,400,4,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
scrvinfo = GETVISUALINFO(scr)
scrfont = GETVALUE(scr,40,4,'p')
/* open window */
w1 = openwindow(portname,,,640,400,2,4,winidcmp,winflags,wintitle,scr,,,)
w1rptr = getwindowrastport(w1)
newmdata = ALLOCMEM(400,MEMF_CLEAR) /* allocate a NewMenu array */
/* with 20 slots */
/* sizeof of NewMenu = 20 */
moffset = 0
call SETVALUE(newmdata,moffset+0,1,'n',NM_TITLE) /* set nm_Type */
label = ALLOCMEM(80,MEMF_CLEAR)
call export(label,"Project")
call SETVALUE(newmdata,moffset+2,4,'p',label) /* set nm_Label */
call SETVALUE(newmdata,moffset+6,4,'p',null()) /* set nm_CommKey */
call SETVALUE(newmdata,moffset+10,2,'n',0) /* set nm_Flags */
call SETVALUE(newmdata,moffset+12,4,'n',0) /* set nm_MutExc */
call SETVALUE(newmdata,moffset+16,4,'p',null()) /* set nm_UserData */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
i1 = ALLOCMEM(80,MEMF_CLEAR)
call export(i1,"New")
call SETVALUE(newmdata,moffset+2,4,'p',i1) /* set nm_Label */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
i2 = ALLOCMEM(80,MEMF_CLEAR)
call export(i2,"Open")
call SETVALUE(newmdata,moffset+2,4,'p',i2) /* set nm_Label */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
i3 = ALLOCMEM(80,MEMF_CLEAR)
call export(i3,"Close")
call SETVALUE(newmdata,moffset+2,4,'p',i3) /* set nm_Label */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
i4 = ALLOCMEM(80,MEMF_CLEAR)
call export(i4,"Save")
call SETVALUE(newmdata,moffset+2,4,'p',i4) /* set nm_Label */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_SUB) /* set nm_Type */
i41 = ALLOCMEM(80,MEMF_CLEAR)
call export(i41,"Save As New")
call SETVALUE(newmdata,moffset+2,4,'p',i41) /* set nm_Label */
i4K1 = ALLOCMEM(80,MEMF_CLEAR)
call export(i4K1,"W")
call SETVALUE(newmdata,moffset+6,4,'p',i4K1) /* set nm_CommKey */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_SUB) /* set nm_Type */
i42 = ALLOCMEM(80,MEMF_CLEAR)
call export(i42,"Save As Old")
call SETVALUE(newmdata,moffset+2,4,'p',i42) /* set nm_Label */
i4K2 = ALLOCMEM(80,MEMF_CLEAR)
call export(i4K2,"S")
call SETVALUE(newmdata,moffset+6,4,'p',i4K2) /* set nm_CommKey */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
call SETVALUE(newmdata,moffset+2,4,'p',NM_BARLABEL) /* set nm_Label */
moffset = moffset + 20
call SETVALUE(newmdata,moffset+0,1,'n',NM_ITEM) /* set nm_Type */
i5 = ALLOCMEM(80,MEMF_CLEAR)
call export(i5,"Quit")
call SETVALUE(newmdata,moffset+2,4,'p',i5) /* set nm_Label */
/* you get the idea, just use ADDTO_NEWMENU !!! */
/* and let APIG do all the grunt work */
/* the point is CREATEMENUSA will try and validate newmdata as an */
/* APIG nmdata structure, its gonna fail so CREATEMENUSA uses it */
/* as-is. */
realmenu = CREATEMENUSA(newmdata,null())
call LAYOUTMENUSA(realmenu,scrvinfo,null())
x = SETMENUSTRIP(w1,realmenu)
exitme = 0
z = pitext(w1rptr,200,80,"A Simple Menu Example",1,0,JAM2,0)
do forever
x = waitpkt(portname)
do forever
msg = '0000 0000'x
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
if class = IDCMP_CLOSEWINDOW then exitme = 1
x = reply(msg,0)
end
if exitme = 1 then leave
end
z = CLOSEWINDOW(w1)
z = FREEMENUS(realmenu)
call FREEVISUALINFO(scrvinfo)
z = CLOSESCREEN(scr)
z = FREEMEM(newmdata,400)
z = FREEMEM(label,80)
z = FREEMEM(i1,80)
z = FREEMEM(i2,80)
z = FREEMEM(i3,80)
z = FREEMEM(i4,80)
z = FREEMEM(i41,80)
z = FREEMEM(i42,80)
z = FREEMEM(i4K1,80)
z = FREEMEM(i4K2,80)
z = FREEMEM(i5,80)
exit