home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d559
/
apig.lha
/
APIG
/
apiglib_v11.lzh
/
e2_window.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-09-28
|
4KB
|
108 lines
/* This example simply opens a window
displays intui-messages received */
/* add library */
x = addlib("apig.library",0,-30,0)
portname = "example2_port" /* this is the name of the port that */
/* intuimessages will be sent to */
p = openport(portname) /* create the port */
call set_apig_globals() /* initialize INTUITION constants */
wintitle = "This is your Window title"
/* the INTUI-Events you want the window to receive */
winidcmp = CLOSEWINDOW+MOUSEMOVE+INTUITICKS+MOUSEBUTTONS+RAWKEY+NEWSIZE,
+ DISKREMOVED+DISKINSERTED
/* set window flags for system gadgets and type of window you want */
winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO,
+ REPORTMOUSE+ACTIVATE+RMBTRAP
scr = 0
/* open window, since scr = 0 the window opens on WorkBench screen */
win = openwindow(portname,0,0,640,200,2,4,winidcmp,winflags,wintitle,scr,1,0,0)
z = writeconsole(win,'0a'x || '0a'x || '0a'x || '0a'x)
z = writeconsole(win,"This example looks for various Intui-Events" || '0a'x)
z = writeconsole(win," looks for mouse moves, resizing the window, " || '0a'x)
z = writeconsole(win," mousebuttons, raw key events, " || '0a'x)
z = writeconsole(win," and inserting/removing a disk " || '0a'x)
z = tickfrequency(win,8)
do forever /* the main 'wait' loop for message arrival */
x = waitpkt(portname)
do forever /* get all message packets until getpkt() returns null */
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
select
when class = CLOSEWINDOW then
do
z = writeconsole(win,"Received CLOSEWINDOW ... bye bye " || '0a'x)
exitme = 1
end
when class = MOUSEMOVE then
z = writeconsole(win,"Yo, MOUSE MOVED" || '0a'x)
when class = INTUITICKS then
z = writeconsole(win,"Yo, INTUITICK" || '0a'x)
when class = MOUSEBUTTONS then
do
z = writeconsole(win,"Yo, MOUSEBUTTONS" || '0a'x)
if getarg(msg,1) = SELECTUP then
z = writeconsole(win," SELECTUP" || '0a'x)
if getarg(msg,1) = SELECTDOWN then
z = writeconsole(win," SELECTDOWN" || '0a'x)
if getarg(msg,1) = MENUUP then
z = writeconsole(win," MENUUP" || '0a'x)
if getarg(msg,1) = MENUDOWN then
z = writeconsole(win," MENUDOWNTUP" || '0a'x)
end
when class = RAWKEY then
do
keycode = getarg(msg,1)
keyqual = getarg(msg,2)
keymap = 0 /* sorry no keymap support */
rkey = convertrawkey(keycode,keyqual,keymap)
z = writeconsole(win,"Yo, RAWKEY")
z = writeconsole(win," ... key " rkey "was pressed" || '0a'x)
end
when class = NEWSIZE then
z = writeconsole(win,"Yo, NEWSIZE" || '0a'x)
when class = DISKREMOVED then
z = writeconsole(win,"Yo, DISKREMOVED" || '0a'x)
when class = DISKINSERTED then
z = writeconsole(win,"Yo, DISKINSERTED" || '0a'x)
otherwise nop
end
x = reply(msg,0)
end
if exitme = 1 then leave
end
do forever /* reply to any message left over */
msg = getpkt(portname)
if msg = '0000 0000'x then leave
x = reply(msg,0)
end
a = closewindow(win)
exit