Adding a gui completely breaks game
by Jacob Wagner · in Torque Game Builder · 11/20/2006 (3:54 pm) · 4 replies
Hi. I am adding a gui with a gui button control. I have added the modal = false property to the gui control. I also tried modal = true for kicks.
I add the gui with Canvas.pushDialog(EndTurn);
When the gui is present, I cannot call either my camera zoom functions, which rely on the mousewheel callbacks, or I cannot select objects, using the selection method in the real time strategy tutorial, which uses the mouse button pressed callbacks. The red box will not show up at all and nothing is echoed in the console. If I disable the gui, I can then zoom and select objects all I want.
Here is the code for the gui:
I add the gui with Canvas.pushDialog(EndTurn);
When the gui is present, I cannot call either my camera zoom functions, which rely on the mousewheel callbacks, or I cannot select objects, using the selection method in the real time strategy tutorial, which uses the mouse button pressed callbacks. The red box will not show up at all and nothing is echoed in the console. If I disable the gui, I can then zoom and select objects all I want.
Here is the code for the gui:
new GuiControl(EndTurn) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "640 480";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
modal = false;
new GuiButtonCtrl() {
canSaveDynamicFields = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "4 23";
Extent = "140 47";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "nextTurn();";
hovertime = "1000";
text = "Next Turn";
groupNum = "-1";
buttonType = "PushButton";
};
};
#2
11/24/2006 (12:38 am)
Ok, I will try that. So I guess the line where i set modal = false doesn't do anything?
#3
11/24/2006 (12:49 am)
Thanks, worked like a charm. Now I can work on my game again (I have this problem that if everything isn't working correctly, I quit work on my games until it is again.)
#4
I actually somehow didn't notice the modal field there, but to answer your question: no, that doesn't do anything. To be more specific, GuiControl doesn't have a 'modal' field (it's a profile thing) so it actually just creates a dynamic field on the GuiControl and gives it a value of zero, but that field is never checked by anything.
Anyway, I'm glad I could help. Good luck on your project, and have fun. ;)
11/25/2006 (7:54 am)
Doh! I know what you mean. I have the opposite problem: I can't sleep if something isn't working how I want it to. I'll stay up till I'm drooling retarded from exhaustion if my system breaks down.I actually somehow didn't notice the modal field there, but to answer your question: no, that doesn't do anything. To be more specific, GuiControl doesn't have a 'modal' field (it's a profile thing) so it actually just creates a dynamic field on the GuiControl and gives it a value of zero, but that field is never checked by anything.
Anyway, I'm glad I could help. Good luck on your project, and have fun. ;)
Torque Owner Thomas Buscaglia
The modal field on a profile means that it should accept mouse events. If you push a GUI Control to your canvas that's modal it will get mouse events instead of GUI Controls beneath it. Try assigning a profile to your GUI that has modal set to false (GuiModelessDialogProfile, for example).
For help on creating your own profiles, check out this tutorial.