Autofocus a subwindow?

BlitzMax Forums/BlitzMax GUI Programming/Autofocus a subwindow?

Can you not disablegadget the mainwindow? When you close the subwindow enablegadget and activategadget
mainwindow.
Bit clunky
SuperStrict

Local win1:TGadget=CreateWindow("Button Example", 200,200,320,240)
Local But1:TGadget=CreateButton("Press me",140,60,80,40, win1)
Repeat
 WaitEvent()
	Select EventID()
		Case EVENT_GADGETACTION
			Select EventSource()
				Case but1
'					ShowGadget win2
					DisableGadget win1
					Local win2:TGadget=CreateWindow("New window",220,220,200,200,win1)
					Local but2:Tgadget=CreateButton("cancel",20,20,80,80,win2)
					Local finished:Int=0
					Repeat
						WaitEvent()
							Select EventID()
								Case event_gadgetaction
									Select EventSource()
										Case but2
											FreeGadget win2
											EnableGadget win1
											ActivateGadget win1
											finished=1
									End Select
								Case event_windowclose
									Select EventSource()
										Case win2
											FreeGadget win2
											EnableGadget win1
											ActivateGadget win1
											finished=1
									End Select
							End Select
					Until finished				
			End Select
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case win1
					End
			End Select			
	End Select
Forever