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

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