home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d559
/
apig.lha
/
APIG
/
apiglib_v11.lzh
/
e12_gadgets.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-09-28
|
4KB
|
111 lines
/* Example Using Gadgets */
/* */
x = addlib("apig.library",0,-30,0)
portname = "example12_port"
p = openport(portname)
call set_apig_globals() /* Create Intuition Global Constants */
wintitle = "APIG.LIBRARY V1.1 Gadgets Example"
winidcmp = CLOSEWINDOW+GADGETUP+GADGETDOWN+MOUSEMOVE
winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE
/* open window */
w1 = openwindow(portname,0,30,640,200,2,4,winidcmp,winflags,wintitle,0,0,0,0)
rpw1 = getwindowrastport(w1)
/* STRING GADGETS */
g0 = makestrgadget(w1,20,20,320,11,GADGHCOMP,RELVERIFY,0,5,0,0,22,0,100)
call setstrgad(g0,"This is a String Gadget")
/* LONGINT STRING GADGETS */
g01 = makestrgadget(w1,20,34,320,11,GADGHCOMP,RELVERIFY+LONGINT,0,3,0,0,23,g0,100)
call setstrgad(g01,"98")
g02 = makestrgadget(w1,20,48,320,11,GADGHCOMP,RELVERIFY+LONGINT+STRINGCENTER,0,2,0,0,24,g0,100)
call setstrgad(g02,"98")
/* BOOL GADGETS */
g2 = makeboolgadget(w1,10,100,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad1",-1),13,GADGHNONE,GADGIMMEDIATE,-1,5,0,0,26,g0)
call makeitext(w1,"BOOLGAD1",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g2)
call makeitext(w1,"GADGHNONE",85,AUTOTOPEDGE,1,2,JAM2,0,g2)
g3 = makeboolgadget(w1,10,120,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad2",-1),13,GADGHCOMP,RELVERIFY,-1,5,0,0,27,g0)
call makeitext(w1,"BOOLGAD2",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g3)
call makeitext(w1,"GADGHCOMP",85,AUTOTOPEDGE,1,2,JAM2,0,g3)
g4 = makeboolgadget(w1,10,140,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad3",-1),13,GADGHBOX,RELVERIFY,-1,5,0,0,28,g0)
call makeitext(w1,"BOOLGAD3",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g4)
call makeitext(w1,"GADGHBOX",85,AUTOTOPEDGE,1,2,JAM2,0,g4)
/* PROP GADGET CustomKnob */
gadknob = loadimage(checkedbuttonbitmap)
g5 = makepropgadget(w1,380,40,90,20,GADGIMAGE,GADGIMMEDIATE+RELVERIFY+FOLLOWMOUSE,-1,FREEVERT+FREEHORIZ,4000,4000,29,g0,gadknob)
call makeitext(w1,"This is a Proportional Gadget",AUTOLEFTEDGE,-10,1,2,JAM2,0,g5)
call makeitext(w1,"With CustomKnob",95,10,1,2,JAM2,0,g5)
/* PROP GADGET AutoKnob */
g6 = makepropgadget(w1,380,100,90,20,GADGHNONE,GADGIMMEDIATE+RELVERIFY+FOLLOWMOUSE,-1,FREEVERT+FREEHORIZ+AUTOKNOB,4000,4000,30,g0)
call makeitext(w1,"This is a Proportional Gadget",AUTOLEFTEDGE,-10,1,2,JAM2,0,g6)
call makeitext(w1,"With An AutoKnob",95,10,1,2,JAM2,0,g6)
z = addglist(w1,g0,-1,-1,0)
z = refreshgadgets(g0,w1,0)
x = horizpot(g5)
y = vertpot(g5)
z = pitext(rpw1,380,63,(" X =" x " "),1,0,JAM2,0)
z = pitext(rpw1,380,72,(" Y =" y " "),1,0,JAM2,0)
exitme = 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 = CLOSEWINDOW then exitme = 1
if getarg(msg,9) = 29 & class = GADGETUP then
do
x = horizpot(g5)
y = vertpot(g5)
z = pitext(rpw1,380,63,(" X =" x " "),1,0,JAM2,0)
z = pitext(rpw1,380,72,(" Y =" y " "),1,0,JAM2,0)
z = reportmouse(0,w1)
end
if getarg(msg,9) = 29 & class = GADGETDOWN then
do
x = horizpot(g5)
y = vertpot(g5)
z = pitext(rpw1,380,63,(" X =" x " "),1,0,JAM2,0)
z = pitext(rpw1,380,72,(" Y =" y " "),1,0,JAM2,0)
z = reportmouse(1,w1)
end
if class = MOUSEMOVE then
do
x = horizpot(g5)
y = vertpot(g5)
z = pitext(rpw1,380,63,(" X =" x " "),1,0,JAM2,0)
z = pitext(rpw1,380,72,(" Y =" y " "),1,0,JAM2,0)
end
x = reply(msg,0)
end
if exitme = 1 then leave
end
call freeimage(gadknob)
a = closewindow(w1)
exit