Can you close a child window without exiting app?

BlitzMax Forums/BlitzMax Beginners Area/Can you close a child window without exiting app?

Amon(Posted 2005) [#1]
I want to close a child window without only whithout shutting down the whole app. If I press the X on the child window it shuts down the whole app.

Is this possible?


EOF(Posted 2005) [#2]
Yup. For this example let's assume 2 windows are open:

mainwin - The main window
childwin - Child window parented to mainwin

Select WaitEvent()
  Case EVENT_WINDOWCLOSE
  If EventSource()=mainwin
     ' close all windows (max will close child window too)
     FreeGadget mainwin
  EndIf
  If EventSource()=childwin
     ' close the child window only
     FreeGadget childwin
  EndIf
End Select



Amon(Posted 2005) [#3]
Thank you. :)