GUIs and mice
by baylor wetzel · in Torque Game Builder · 09/05/2009 (10:59 pm) · 7 replies
It's been awhile, i forget, can i use a mouse with TGB objects (like t2dStaticSprite) when a GUI is open?
i just added a debug GUI with a drop down to change some game variables and now none of my buttons in my game (all of which are non-GUI, just sprites with mouse down events) respond to the mouse
The debug GUI is loaded with Canvas.pushDialog()
If memory serves correctly, i might be screwed (which is a shame because i don't know a good way to make a non-GUI dropdown list), but i figured i'd ask
i just added a debug GUI with a drop down to change some game variables and now none of my buttons in my game (all of which are non-GUI, just sprites with mouse down events) respond to the mouse
The debug GUI is loaded with Canvas.pushDialog()
If memory serves correctly, i might be screwed (which is a shame because i don't know a good way to make a non-GUI dropdown list), but i figured i'd ask
About the author
#2
i have a file called emotionSelectionGUI.gui containing a GUI named emotionSelectionGUI which contains two items, emotionDropDown and closeDialogButton
i've tried using a function such as:
and i've edited the GUI itself:
Either way, when the GUI is open (via pushDialog), i can't get to any of the other buttons on the screen (which are just sprites with a Button behavior that calls onClick on mouse down)
09/06/2009 (2:08 am)
Phil, how precisely would i use that?i have a file called emotionSelectionGUI.gui containing a GUI named emotionSelectionGUI which contains two items, emotionDropDown and closeDialogButton
i've tried using a function such as:
function showDebug()
{
Canvas.pushDialog(emotionSelectionGUI);
emotionSelectionGUI.modal = false;
}and i've edited the GUI itself:
%guiContent = new GuiControl(emotionSelectionGUI) {
modal = false;
canSaveDynamicFields = "0";
isContainer = "1";
etc...Either way, when the GUI is open (via pushDialog), i can't get to any of the other buttons on the screen (which are just sprites with a Button behavior that calls onClick on mouse down)
#3
09/06/2009 (2:27 am)
It has to be in the control's profile.if(!isObject(GuiModelessDialogProfile)) new GuiControlProfile("GuiModelessDialogProfile")
{
modal = false;
};
//-------------------------------------------------------------------------
%guiContent = new GuiControl(emotionSelectionGUI) {
profile = "GuiModelessDialogProfile";
canSaveDynamicFields = "0";
isContainer = "1";
...
#4
i've verified that i'm execing guiProfiles.cs before execing the GUI itself (in case that matters), i tried the profile name with and without quotes (all the samples in guiProfiles are without quotes), i can see from the help files that modal is a field (although it's listed as deprecated in 1.7.4; no mention of what would replace it) and that i'm spelling it correctly. i wonder what it is i'm doing wrong
09/06/2009 (3:41 am)
Hmm, is there perhaps another trick i'm missing, or a way to debug this?i've verified that i'm execing guiProfiles.cs before execing the GUI itself (in case that matters), i tried the profile name with and without quotes (all the samples in guiProfiles are without quotes), i can see from the help files that modal is a field (although it's listed as deprecated in 1.7.4; no mention of what would replace it) and that i'm spelling it correctly. i wonder what it is i'm doing wrong
#5
09/06/2009 (3:47 am)
Modal depreciated? Where did you see that?
#6
Pushing a dialog to the screen places it on the top layer, so that you can't interact with the other gui elements / TGB. If you use setContent(), then the canvas is set to that element alone and TGB can still receive mouse events. That's how I recall it anyways. Its been quite a while since I used conventional GUI elements.
09/06/2009 (11:19 am)
I believe the problem is that you are using "pushDialog" when you really want to be using "setContent".Pushing a dialog to the screen places it on the top layer, so that you can't interact with the other gui elements / TGB. If you use setContent(), then the canvas is set to that element alone and TGB can still receive mouse events. That's how I recall it anyways. Its been quite a while since I used conventional GUI elements.
#7
@Ashteth, setContent() sets the background. It requires you to fill in the whole screen with something. In my case, all i have is a drop down. When i use setContent() with it, it replaces MainScreen.gui with it and causes the mouse to draw garbage all over the screen. While pushDialog() certainly sounds like it should be modal, i believe it's the only alternative to setContent() and the normal way of adding GUI elements on top of a scene
09/06/2009 (12:34 pm)
@Phil, in the docs you download with 1.7.4, under TGB Reference->GuiControl->Fields->Modal the only description is "Modal Type: deprecated"@Ashteth, setContent() sets the background. It requires you to fill in the whole screen with something. In my case, all i have is a drop down. When i use setContent() with it, it replaces MainScreen.gui with it and causes the mouse to draw garbage all over the screen. While pushDialog() certainly sounds like it should be modal, i believe it's the only alternative to setContent() and the normal way of adding GUI elements on top of a scene
Associate Phillip O'Shea
Violent Tulip
Hope that helped!