home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / e / EasyGUI_v33b2.lha / Src / EasyGUI / testaw.e < prev    next >
Text File  |  1997-02-10  |  2KB  |  57 lines

  1. -> testaw.e - shows use of AppWindow handling and changing GUIs
  2. MODULE 'tools/easygui',
  3.        'workbench/startup', 'workbench/workbench'
  4.  
  5. CONST MAXLEN=20
  6.  
  7. DEF current=0, gui:PTR TO LONG
  8.  
  9. PROC main()
  10.   DEF s[MAXLEN]:STRING
  11.   -> Have a list of three different GUIs
  12.   gui:=[
  13.          [LISTV,{ignore},'Drop Icons on Me!',15,7,NIL,0,1,0,0,0,{gadappw}],
  14.          [ROWS,[STR,{ignore},'Drop Icons on Me:',s,MAXLEN,5,0,0,0,{gadappw}],
  15.                [SPACEV],[BUTTON,{ignore},'But Not on Me']],
  16.          [ROWS,[BUTTON,{ignore},'Drop Icons on Me:',0,0,{gadappw}],
  17.                [SPACEV],[STR,{ignore},'Not on Me:',s,MAXLEN,5]]
  18.        ]
  19.   easyguiA('Test App Window', gui[current],
  20.           [EG_AWPROC,{winappw}, NIL])
  21. ENDPROC
  22.  
  23. -> Ignore button presses etc.
  24. PROC ignore(info,num) IS EMPTY
  25.  
  26. -> Show next GUI in list
  27. PROC nextgui(gh)
  28.   current++
  29.   IF current>=ListLen(gui) THEN current:=0
  30.   changegui(gh, gui[current])
  31. ENDPROC
  32.  
  33. -> Default (window) App message handler
  34. PROC winappw(info,awmsg)
  35.   PrintF('You missed the gadget... try again!\n')
  36. ENDPROC
  37.  
  38. -> App message handler for a gadget
  39. PROC gadappw(info,awmsg)
  40.   PrintF('You hit the gadget!  ')
  41.   showappmsg(awmsg)
  42.   nextgui(info)
  43. ENDPROC
  44.  
  45. -> Show the contents of the App message
  46. PROC showappmsg(amsg:PTR TO appmessage)
  47.   DEF i, args:PTR TO wbarg
  48.   PrintF('Hit at (\d,\d)\n', amsg.mousex, amsg.mousey)
  49.   args:=amsg.arglist
  50.   FOR i:=1 TO amsg.numargs
  51.     PrintF('   arg(\d): Name="\s", Lock=$\h\n',
  52.            i, args.name, args.lock)
  53.     args++
  54.   ENDFOR
  55.   PrintF('\n')
  56. ENDPROC
  57.