home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / easygui_os12 / examples / easygui / testaw_os12.e < prev    next >
Encoding:
Text File  |  2000-06-05  |  1.8 KB  |  73 lines

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