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

  1. -> testmulti2.e - Another very simple use of multi-window GUI support.
  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 'tools/exceptions', 'intuition/intuition'
  17.  
  18. -> The global for use with multiforall().
  19. DEF gh:PTR TO guihandle
  20.  
  21. PROC main() HANDLE
  22.   DEF mh=NIL, gh1:PTR TO guihandle,res
  23.   mh:=multiinit()
  24.   gh1:=addmultiA(mh,'GUI One',
  25.                 [ROWS,
  26.                   [TEXT,'The first GUI.',NIL,TRUE,13],
  27.                   [SBUTTON,{but1},'Press Me']
  28.                 ],
  29.                 [EG_LEFT,10, EG_TOP,20, NIL])
  30.   addmultiA(mh,'GUI Two',
  31.                 [ROWS,
  32.                   [TEXT,'And the second GUI.',NIL,TRUE,13],
  33.                   [SBUTTON,{but2},'Press Me']
  34.                 ],
  35.                 -> Put the second window below the first, but hidden.
  36.                 [EG_LEFT,10, EG_TOP,gh1.wnd.topedge+gh1.wnd.height,
  37.                  EG_HIDE,TRUE, NIL])
  38.   -> Could add more...
  39.   res:=multiloop(mh)
  40. EXCEPT DO
  41.   cleanmulti(mh)
  42.   report_exception()
  43. ENDPROC
  44.  
  45. -> Button on GUI one does something special.
  46. PROC but1(info:PTR TO guihandle)
  47.   WriteF('Hit button on GUI One. Closing then opening.\n')
  48.   multiforall({gh},info.mh,
  49.              `IF gh.wnd THEN WriteF('Title="\s"\n',gh.wnd.title) BUT closewin(gh) ELSE 0)
  50.   WriteF('Sleeping a bit...\n')
  51.   Delay(100)
  52.   WriteF('Awake!\n')
  53.   -> This shows that gh.wnd is NIL when the window is closed.
  54.   multiforall({gh},info.mh,
  55.               `WriteF('Win=$\h\n',gh.wnd) BUT openwin(gh))
  56. ENDPROC
  57.  
  58. PROC but2(i) IS WriteF('Hit button on GUI Two\n')
  59.