Can't create children of disabled gadgets

Archives Forums/BlitzMax Bug Reports/Can't create children of disabled gadgets

dan_upright(Posted 2013) [#1]
SuperStrict

Import maxgui.drivers

Local win:TGadget = CreateWindow("Test", 0, 0, 320, 240, Null, WINDOW_CLIENTCOORDS | WINDOW_CENTER | WINDOW_TITLEBAR)
Local redo:TGadget = CreateButton("Redo", 0, 0, 100, 20, win)
Local panel:TGadget = CreatePanel(100, 0, 320, 140, win, PANEL_GROUP, "Panel")

Repeat
	WaitEvent()
	
	Select EventID()
		Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
			End
		Case EVENT_GADGETACTION
			If EventSource() = redo Then
				DisableGadget(win)
				FreeGadget panel
				panel = CreatePanel(100, 0, 320, 140, win, PANEL_GROUP, "Panel")
				EnableGadget(win)
				EnableGadget(panel)
			End If
	End Select
Forever


Run this and click "redo" - because the panel is created while it's parent window is disabled, it is permanently disabled.