Game Development Community

If I pushDialog two dialog boxes, I can't use the first one?

by John Klimek · in Torque Game Builder · 03/02/2006 (12:28 pm) · 5 replies

Let's say I use the following three commands:

Canvas.setContent(mainScreenGui);
Canvas.pushDialog(lobbyChatGui); // contains a GuiControl and GuiWindowCtrl
Canvas.pushDialog(gameRoomListingGui); // same setup as lobbyChatGui)

On my screen the background is from mainScreenGui, there is a window (lobbyChatGui) at the bottom of the my screen, and another window (gameRoomListingGui) at the top of my screen.

The problem is that I can't use my first pushed dialog (lobbyChatGui).

Are you only allowed to use the most recently pushed dialog?

I thought I'd split up my Gui into several Gui objects and then push a whole bunch of them to the screen. Am I thinking about this incorrectly?

Thanks for any help...

#1
03/02/2006 (1:20 pm)
The GuiProfile definition can have a "Modal = false;" parameter which makes the dialog pass clicks down the chain of visible and active GUIs.

Check the common/ui/defaultProfiles.cs script and you'll see that the mother of all GuiProfiles (GuiDefaultProfile) sets Modal to true right off the bat, so you'll have to set/override this in your own profile.
#2
03/02/2006 (4:12 pm)
Ahh! Thanks!

Which Gui(s) should modal = false then? (the mainScreenGui [which is the background/main gui] or the two "dialog" guis?)

In my two dialog gui's right underneath:

//--- OBJECT WRITE BEGIN ---
new GuiControl(GameroomListingGui) {

...I put a line:

modal = false

...but that didn't fix the problem. I still wasn't able to click on anything on my first dialog box...
#3
03/02/2006 (4:17 pm)
Modal = false

needs to be in the profile used by the gui control... you can also use .add() to add a GUI to a screen vs pushing the entire dialog over it.
#4
03/02/2006 (4:18 pm)
Canvas.setContent(mainScreenGui);
mainScreenGui.add(lobbyChatGui); // contains a GuiControl and GuiWindowCtrl
mainScrenGui.add(gameRoomListingGui); // same setup as lobbyChatGui)

Just make sure these GUIs aren't the entire screen, this means t hat if you create them in the GUI Editor they will have to be sub GUIs of something else since the editor always sizes the parent control to fit the entire screen.
#5
03/02/2006 (4:24 pm)
That worked!

All of my dialogs are of type "GuiControl" (which then contains a GuiWindowCtrl, etc). I'm not sure if thats good or bad, or if that's what you're talking about...

Anyways, I made my GuiControl use the GuiModelessDialogProfile and now everything works nicely. =)