window modal

BlitzMax Forums/BlitzMax Beginners Area/window modal

Smokey(Posted 2005) [#1]
Hi

I would like to load a second window but modal, I did't found anything in the doc but bmax ide have such modal window in 'IDE options window' but it's not modal, if I switch tab and come back in maxide then option box is no longer modal it minimize someone have a clue doing this ?


WendellM(Posted 2005) [#2]
Interesting question - here's a quick attempt I just put together to explore it. I'm not sure if this will do exactly what you need, but it disables the "main" window when the modal one is launched and reenables it when the modal one closes:



In this example, you can't do anything with the main window or its gadgets once the modal one is launched. The EVENT_APPRESUME checking makes sure that the right one is brought back to front when you alt-tab away and back. I have to use a "modalhidden" flag since GadgetHidden doesn't seem to work with windows (it always returns false even if the window is hidden).

I've only tried this in Windows, not Mac OS or Linux.


REDi(Posted 2005) [#3]
win:tgadget = CreateWindow("",0,0,GadgetWidth(Desktop()),GadgetHeight(Desktop()))
win1:tgadget = CreateWindow("",0,0,320,240,win)
DisableGadget(win)

While EventID()<>EVENT_WINDOWCLOSE
	WaitEvent()
Wend



Smokey(Posted 2005) [#4]
Thanks that help a lot :)

Wendel your method is pretty good the only thing is that we see all the window when the program start and it hide it, can be a problem if I load more then one window at startup..

Papa your method is very good
here my version

here my code
win:tgadget = CreateWindow("",0,0,GadgetWidth(Desktop()),GadgetHeight(Desktop()))
win1:tgadget = CreateWindow("",0,0,320,240,win)
DisableGadget(win)

While WaitEvent()

Select EventID()
		Case EVENT_WINDOWCLOSE
		   If EventSource()= win Then
		      End
		   Else
			  If EventSource()=win1 Then
			     HideGadget win1:TGadget
			     EnableGadget(win)
			     activatewindow(win)
		      End If
		   End If

	
	End Select

Wend



even if I enable the window again it did't re-activate it we must do it manualy.. also the program create the window modal at startup, if I create it when I need it
the EventSource() can't detect windowmodal because it don't exist how to avoid this?


REDi(Posted 2005) [#5]
You could always stick your modal window into a function with its own event loop...