Can you close a child window without exiting app?

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

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?

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


Thank you. :)