why would a gouped window close the app

BlitzMax Forums/BlitzMax GUI Programming/why would a gouped window close the app

@D-Grafix

Here's some simple code that might help:

SuperStrict

Local window:TGadget = CreateWindow("Main Window",50, 50, 240, 240)
Local button:TGadget = CreateButton("Click Me", 5, 5, 100, 50, window)

Local modal:TGadget = CreateWindow("Modal Window",50, 50, 200, 200, window, WINDOW_TITLEBAR | WINDOW_HIDDEN)

While WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			If EventSource() = window Then End
			If EventSource() = modal
				EnableGadget button
				EnableGadget window
				HideGadget modal
			EndIf	
		Case EVENT_GADGETACTION
			DisableGadget button
			DisableGadget window
			ShowGadget modal
	End Select
Wend


EDIT: If you want the main window's gadgets to have a 'greyed-out' appearance when the subwindow is displayed you will need to disable each one accordingly. Updated the code sample to reflect this.