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 >
OS/2 REXX Batch file  |  1991-09-28  |  4KB  |  111 lines

  1. /*  Example Using Gadgets */
  2.  
  3. /*  */
  4. x = addlib("apig.library",0,-30,0)
  5.  
  6. portname = "example12_port"
  7. p = openport(portname)
  8. call set_apig_globals()          /* Create Intuition Global Constants */
  9.  
  10. wintitle = "APIG.LIBRARY V1.1 Gadgets Example"
  11. winidcmp = CLOSEWINDOW+GADGETUP+GADGETDOWN+MOUSEMOVE
  12. winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE
  13.  
  14. /* open window */
  15. w1  = openwindow(portname,0,30,640,200,2,4,winidcmp,winflags,wintitle,0,0,0,0) 
  16. rpw1 = getwindowrastport(w1) 
  17.  
  18. /* STRING GADGETS  */
  19. g0  = makestrgadget(w1,20,20,320,11,GADGHCOMP,RELVERIFY,0,5,0,0,22,0,100)
  20. call setstrgad(g0,"This is a String Gadget")
  21.  
  22. /* LONGINT STRING GADGETS */
  23. g01  = makestrgadget(w1,20,34,320,11,GADGHCOMP,RELVERIFY+LONGINT,0,3,0,0,23,g0,100)
  24. call setstrgad(g01,"98")
  25.  
  26. g02  = makestrgadget(w1,20,48,320,11,GADGHCOMP,RELVERIFY+LONGINT+STRINGCENTER,0,2,0,0,24,g0,100)
  27. call setstrgad(g02,"98")
  28.  
  29. /* BOOL GADGETS */
  30. g2  = makeboolgadget(w1,10,100,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad1",-1),13,GADGHNONE,GADGIMMEDIATE,-1,5,0,0,26,g0)
  31. call makeitext(w1,"BOOLGAD1",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g2)
  32. call makeitext(w1,"GADGHNONE",85,AUTOTOPEDGE,1,2,JAM2,0,g2)
  33.  
  34. g3  = makeboolgadget(w1,10,120,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad2",-1),13,GADGHCOMP,RELVERIFY,-1,5,0,0,27,g0)
  35. call makeitext(w1,"BOOLGAD2",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g3)
  36. call makeitext(w1,"GADGHCOMP",85,AUTOTOPEDGE,1,2,JAM2,0,g3)
  37.  
  38. g4  = makeboolgadget(w1,10,140,(2*AUTOLEFTEDGE)+textlength(rpw1,"boolgad3",-1),13,GADGHBOX,RELVERIFY,-1,5,0,0,28,g0)
  39. call makeitext(w1,"BOOLGAD3",AUTOLEFTEDGE,AUTOTOPEDGE,1,2,JAM2,0,g4)
  40. call makeitext(w1,"GADGHBOX",85,AUTOTOPEDGE,1,2,JAM2,0,g4)
  41.  
  42.  
  43. /* PROP GADGET CustomKnob */
  44. gadknob = loadimage(checkedbuttonbitmap)
  45. g5  = makepropgadget(w1,380,40,90,20,GADGIMAGE,GADGIMMEDIATE+RELVERIFY+FOLLOWMOUSE,-1,FREEVERT+FREEHORIZ,4000,4000,29,g0,gadknob)
  46. call makeitext(w1,"This is a Proportional Gadget",AUTOLEFTEDGE,-10,1,2,JAM2,0,g5)
  47. call makeitext(w1,"With CustomKnob",95,10,1,2,JAM2,0,g5)
  48.  
  49. /* PROP GADGET AutoKnob */
  50. g6  = makepropgadget(w1,380,100,90,20,GADGHNONE,GADGIMMEDIATE+RELVERIFY+FOLLOWMOUSE,-1,FREEVERT+FREEHORIZ+AUTOKNOB,4000,4000,30,g0)
  51. call makeitext(w1,"This is a Proportional Gadget",AUTOLEFTEDGE,-10,1,2,JAM2,0,g6)
  52. call makeitext(w1,"With An AutoKnob",95,10,1,2,JAM2,0,g6)
  53.  
  54.  
  55. z = addglist(w1,g0,-1,-1,0) 
  56. z = refreshgadgets(g0,w1,0)
  57. x = horizpot(g5)
  58. y = vertpot(g5)
  59. z = pitext(rpw1,380,63,(" X =" x "    "),1,0,JAM2,0)
  60. z = pitext(rpw1,380,72,(" Y =" y "    "),1,0,JAM2,0)
  61. exitme = 0
  62. do forever
  63.      x = waitpkt(portname)
  64.   
  65.      do forever 
  66.   
  67.         msg = '0000 0000'x
  68.         msg = getpkt(portname)
  69.         if msg = '0000 0000'x then leave
  70.         class = getarg(msg,0)
  71.         if class = CLOSEWINDOW then exitme = 1
  72.  
  73.         if getarg(msg,9) = 29 & class = GADGETUP then
  74.            do
  75.               x = horizpot(g5)
  76.               y = vertpot(g5)
  77.               z = pitext(rpw1,380,63,(" X =" x "    "),1,0,JAM2,0)
  78.               z = pitext(rpw1,380,72,(" Y =" y "    "),1,0,JAM2,0)
  79.               z = reportmouse(0,w1)
  80.            end
  81.  
  82.         if getarg(msg,9) = 29 & class = GADGETDOWN then
  83.            do
  84.               x = horizpot(g5)
  85.               y = vertpot(g5)
  86.               z = pitext(rpw1,380,63,(" X =" x "    "),1,0,JAM2,0)
  87.               z = pitext(rpw1,380,72,(" Y =" y "    "),1,0,JAM2,0)
  88.               z = reportmouse(1,w1)
  89.            end
  90.  
  91.         if class = MOUSEMOVE then 
  92.            do   
  93.               x = horizpot(g5)
  94.               y = vertpot(g5)
  95.               z = pitext(rpw1,380,63,(" X =" x "    "),1,0,JAM2,0)
  96.               z = pitext(rpw1,380,72,(" Y =" y "    "),1,0,JAM2,0)
  97.            end
  98.  
  99.         x = reply(msg,0)  
  100.      end  
  101.    if exitme = 1 then leave
  102.    
  103. end
  104.  
  105. call freeimage(gadknob)
  106.  
  107. a = closewindow(w1)
  108.  
  109. exit
  110.  
  111.