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
/
newmenus3.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-03-11
|
10KB
|
223 lines
/* Example Using New Menus */
/* This example is the same as newmenus1, */
/* but we force an error by creating too many */
/* menuitems for a menu */
x = addlib("apig.library",0,-30,0)
portname = "nmex3_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 = MAKENEWMENU() /* this is gonna allocate a NewMenu array */
/* initially with 20 (default) empty slots */
/* MAKENEWMENU(50), would allocate 50 */
/* use ADDTO_NEWMENU to fill the NewMenu array */
/* IF more than 20 (initial #slots) calls are */
/* made to ADDTO_NEWMENU, then ADDTO_NEWMENU */
/* will automatically re-allocate the array to */
/* hold an additional 20 array entries. */
call ADDTO_NEWMENU(newmdata,NM_TITLE,"Project","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"New","N",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"Open","O",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"Close","C",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"Save","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_SUB,"Save As New","W",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_SUB,"Save as Old","S",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,NM_BARLABEL,"",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"Quit","Q",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_TITLE,"Subject 1","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 1","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 2","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 3","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 4","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 5","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 6","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 7","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 8","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 9","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_TITLE,"Subject 2","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 1","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 2","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 3","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 4","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 5","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 6","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 7","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 8","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 9","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 9","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -10","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,NM_BARLABEL,"",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,NM_BARLABEL,"",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,NM_BARLABEL,"",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -11","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -12","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -13","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -14","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -15","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -16","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -17","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -18","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -19","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
/* now we just add a bunch to force an error */
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM -20","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_TITLE,"Subject 3","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 1","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 2","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 3","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 4","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 5","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 6","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 7","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 8","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_ITEM,"ITEM - 9","",0,0,null())
call ADDTO_NEWMENU(newmdata,NM_END,"","",0,0,null())
/* Now that the NewMenu array has been filled, we create the */
/* menu using CREATEMENUS(). We specify the GTMN_SECONDARYERROR */
/* tag in order to get the error code returned back to us. It is */
/* little "features" like this that make testing APIG a pain. */
errptr = ALLOCMEM(4,MEMF_CLEAR) /* pointer to LONG integer, where */
/* error value will be returned */
realmenu = CREATEMENUS(newmdata,GTMN_SECONDARYERROR,errptr,TAG_DONE,0)
/* get the value of the error, should = 1 = GTMENU_TRIMMED */
say "CREATEMENU ERROR VALUE = " getvalue(errptr,0,4,'n')
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 = FREETHIS(newmdata)
z = FREEMEM(errptr,4)
exit