Getting a window to not take control
by Ricky Taylor · in Torque Game Builder · 12/17/2005 (2:17 pm) · 3 replies
Is there a way to make a guiWindow that doesnt take complete control?
I need to be able to click buttons on the origional Gui...
Also, can you dynamically add controls to Guis?
Thanks in advanced.
Ricky,
I need to be able to click buttons on the origional Gui...
Also, can you dynamically add controls to Guis?
Thanks in advanced.
Ricky,
#2
I'd recommend creating a new profile that inherits GuiDefaultProfile, and set 'modal = false' in that, and use that for the controls that you pop up over others (or if you're already using your own custom profiles, just add 'modal = false' to those).
Takes a little experimentation to get it to do exactly what you want, but it is possible.
12/17/2005 (11:01 pm)
You can actually pop up separate GUIs with pushDialog() and still click through to other guis behind it, if you've set "modal = false" in the profile that you use for the front-most gui control. GuiDefaultProfile sets 'modal = true' by default so nothing exhibits this behavior out of the box.I'd recommend creating a new profile that inherits GuiDefaultProfile, and set 'modal = false' in that, and use that for the controls that you pop up over others (or if you're already using your own custom profiles, just add 'modal = false' to those).
Takes a little experimentation to get it to do exactly what you want, but it is possible.
#3
Although the profile idea seems more robust....
This is just what I needed!
12/18/2005 (12:03 pm)
Excellent! The non-modal dialogs is just mainGameGui.add! Thanks LOADS!Although the profile idea seems more robust....
This is just what I needed!
Torque Owner Scott Coursey
Yellow Duck Software
Yes, you can dynamically create controls. Let's say you have a GUI named MainWindowGui. Inside the script, you'd put:
new GuiButtonCtrl ( newBtn ) { profile = "GuiButtonProfile"; position = "10 10"; extent = "10 10"; text = "X"; command = "MainWindowGui.newBtnPressed ( \"New Button\" );"; buttonType = "PushButton"; };You'd also need the command available:
function MainWindowGui.newBtnPressed ( %this, %val ) { MessageBoxOk ( "PRESS", "The " @ %val @ " button was pressed." ); }Ok, that creates the control. You can't see it yet. You need to also call:
Now you'll see your shiny new button. This, of course, would work for any of the GUI controls. Calling the "add" is the key.
(edit: updated the code a little)