Autofocus a subwindow?

BlitzMax Forums/BlitzMax GUI Programming/Autofocus a subwindow?

Hi everyone!

In my app I have a main window and several child windows.
I'd like setting the "focus" on the subwindow when it is open, i.e.:

- The user can't switch back to the main app window until he closes the subwindow
- The user can't use the gui menu + all gadgets on the main window while the subwindow is open.

Take the "about window" of Firefox for instance.
Every modern app has this functionality theses days.

Grisu

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


Thanks for the example. Didn't know that you can disable a whole window (and with gadgets) with one command.