Make a dialog window

BlitzMax Forums/MaxGUI Module/Make a dialog window

_JIM(Posted 2009) [#1]
Is there a way to make a window behave like a dialog?

I am trying to make on of those windows like "RequestFile" (but for a different purpose) that take control of everything until they're closed.

Is there a way to do this in MaxGUI?


SebHoll(Posted 2009) [#2]
The best way to do this is to have your dialog window created with your main window as its group (in the CreateWindow() call). When you want to show your dialog window, disable your main window and your child window should then become somewhat modal.

ShowGadget( wndDialog )
DisableGadget( wndMain )
And then when you are finished, make sure to re-enable your main window again.

EnableGadget( wndMain )
HideGadget( wndDialog )
This should work as expected on Windows. Not entirely sure about Mac OS X or FLTK Linux though...


SebHoll(Posted 2009) [#3]
Not entirely sure about Mac OS X or FLTK Linux though...

OK - just committed a fix to SVN for MaxGUI.FLTKMaxGUI so you should get this same behaviour on Linux too.


_JIM(Posted 2009) [#4]
Thank you very much, Seb.


Sanctus(Posted 2009) [#5]
Hmm.. I'm trying to do the same thing but I can't seem to get it to work.
I have this code:
Type TSettingsWnd
	Global wnd:TGadget
	
	Function Create()
		wnd = CreateWindow("Settings", 200, 200, 200, 400, TApp.Wnd)
		ShowGadget(wnd)
		DisableGadget(TApp.Wnd)
		Run()
	End Function
	
	Function Run()
		While WaitEvent()
			Select EventID()
				Case EVENT_WINDOWCLOSE
					If EventSource() = wnd
						close()
					EndIf
			End Select
		WEnd
	End Function
	
	Function close()
		
		EnableGadget(TApp.Wnd)
		HideGadget(wnd)
	End Function
End Type

TApp.wnd is the main window
The settings window shows up but when I try to close it, it dissapears and the main wnd still remains disabled (though I did put enablegadget)


jsp(Posted 2009) [#6]
Where does the program return to when it leaves the Function close()?
Is it still in an event loop where events of the main window are processed? Otherwise you got stuck there.

BTW: Logic Gui includes type creation ;)


Sanctus(Posted 2009) [#7]
Yeah good point... fixed it. It remained in the loop from the run function (not the main loop)
Frankly I like your logic gui but there's something that doesn't make me feel like home about it. I mean I'd like a tool like that included in a IDE. If you would work with Ziggy and make it as a plugin for Blide Pro(The IDE I use) I'd really buy it and use it.


jsp(Posted 2009) [#8]
Yeah, I understand. Nothing is perfect, but there are at least some users using both successful.
Actually there are different ways one could use, but writing an e.g. Interface.bmx file from Logic Gui which contains all windows as independent types and you simply import this file in BLIde is easy. Thus you can work just fine with your IDE and call your imported types/gui as any other module functions.