GUI Control Properties - Documentation
by Bryce Bangerter · in Torque Game Builder · 06/21/2006 (6:12 pm) · 12 replies
Can someone please point me to where I can find documentation on the various properties and uses of all the GUI controls? The TDN pages are still quite sparse with information.
I found a tutorial on adding buttons and was able to get buttons working pretty easily. What I'm specifically looking for at the moment is information on the difference between GuiEditCtrl/GuiTextEditCtrl (I want to allow players to enter their name into a high score table).
I'm also looking for a way allow users to configure the game controls in a setup screen. I'm thinking maybe GuiBitmapButtonTextCtrl will give me what I want to allow a user to 'select' a control and then press a key to change it's value and display that visually in the UI. But with little to no documentation on the somewhat long list of controls available I may be missing a better way to do this.
I've been searching the forums, but have so far come up blank with my search terms.
I found a tutorial on adding buttons and was able to get buttons working pretty easily. What I'm specifically looking for at the moment is information on the difference between GuiEditCtrl/GuiTextEditCtrl (I want to allow players to enter their name into a high score table).
I'm also looking for a way allow users to configure the game controls in a setup screen. I'm thinking maybe GuiBitmapButtonTextCtrl will give me what I want to allow a user to 'select' a control and then press a key to change it's value and display that visually in the UI. But with little to no documentation on the somewhat long list of controls available I may be missing a better way to do this.
I've been searching the forums, but have so far come up blank with my search terms.
#2
The second contains a complete list of the controls available, but only provides minimal documentation on about 1 in 15 of those controls. The remainder have no documtation what-so-ever at present.
06/21/2006 (6:34 pm)
Yes, looked at both of those (along with a couple of other pages in TDN). The first page is just a basic description of GUI in general. Nothing on how to use T2D's GUI editor or any of it's controls.The second contains a complete list of the controls available, but only provides minimal documentation on about 1 in 15 of those controls. The remainder have no documtation what-so-ever at present.
#3
06/21/2006 (7:30 pm)
Documentation is extremely sparse for GUI controls. A few days ago, I started a thread about how to script radio buttons, which have no documentation or examples; but got no response. Depending on the forums can be a hit-or-miss type of thing. Now that TGB has been released, perhaps adequate documentation will become a priority for the GG team.
#4
A very useful command is the .dump() command. In exploring the GUI system in the past I would name a gui Object (like testList) and then go to the console and type "testList.dump();" which would then provide me with a list of all methods and fields for that object, you can usually figure out how to use that specific GUI control very easiliy from that point.
Now that the majority of TGB is documented (though we are still working on even more docs for just about all of TGB) we can now try and produce a GUI doc. Sorry I missed your radio button question Don, could you post a link to it here and I'll try and answer it :)
06/22/2006 (10:29 am)
Adequate documentation was probably the highest priority in the last month of dev time for TGB before release. Unfortunately the one area we didn't get to hit on was the GUI. I know the GUI system fairly well and would love to answer any questions you may have and if I don't know a direct answer I should be able to direct you in a direction to get an answer.A very useful command is the .dump() command. In exploring the GUI system in the past I would name a gui Object (like testList) and then go to the console and type "testList.dump();" which would then provide me with a list of all methods and fields for that object, you can usually figure out how to use that specific GUI control very easiliy from that point.
Now that the majority of TGB is documented (though we are still working on even more docs for just about all of TGB) we can now try and produce a GUI doc. Sorry I missed your radio button question Don, could you post a link to it here and I'll try and answer it :)
#5
Figured it out, gotta mount it to top, not bottom.
06/22/2006 (10:38 am)
I was curious as to how to anchor my menubar to the bottom of the window so it stayed there through window re-sizes.Figured it out, gotta mount it to top, not bottom.
#6
http://www.garagegames.com/mg/forums/result.thread.php?qt=45822
06/22/2006 (10:57 am)
Matthew, here is my radio button question thread:http://www.garagegames.com/mg/forums/result.thread.php?qt=45822
#7
First harder (relatively speaking) question then :)
I want to create a setup screen that allows a player to configure controls in the game. E.g., default is A moves left, D moves right.
I'm thinking I will use the GuiBitmapButtonTextCtrl. The text value of the button would be the current key corresponding to a given action. How do I center justify the text and how do I change the color of the text? Using .dump I found the method to set the text value (setText) but I did not see any methods of modifying how that text is displayed within the button.
In further research I'm guessing I will need to write a customProfiles.cs file to overwrite the defaultProfiles.cs file. Only, on my installation of RC1 there is no defaultProfiles.cs for me to model my custom one after. I did find a profiles.ed.cs under tools\gui - but I'm not certain this is the file I'm looking for.
06/22/2006 (6:24 pm)
Dump should come in handy for the basic easy questions.First harder (relatively speaking) question then :)
I want to create a setup screen that allows a player to configure controls in the game. E.g., default is A moves left, D moves right.
I'm thinking I will use the GuiBitmapButtonTextCtrl. The text value of the button would be the current key corresponding to a given action. How do I center justify the text and how do I change the color of the text? Using .dump I found the method to set the text value (setText) but I did not see any methods of modifying how that text is displayed within the button.
In further research I'm guessing I will need to write a customProfiles.cs file to overwrite the defaultProfiles.cs file. Only, on my installation of RC1 there is no defaultProfiles.cs for me to model my custom one after. I did find a profiles.ed.cs under tools\gui - but I'm not certain this is the file I'm looking for.
#8
EDIT: I'll also be interested (as many others well) to the solution of Bryce's request on how to do 'custom input settings'!
06/23/2006 (5:32 am)
It's amazing looking at this thread and Don's, i was gonna post the exact same questions regarding the lack of documentation on the gui's (it's a bit like how tge/tgb ea beta was prior to the upgrades and injection of documentation, learning in the dark), but hopefully this .dump() command well help :)EDIT: I'll also be interested (as many others well) to the solution of Bryce's request on how to do 'custom input settings'!
#9
06/23/2006 (8:43 am)
Yes! I think many of us are very interested in how to do custom input settings. It's basic enough that it should be on TDN.
#10
- Jesse
06/23/2006 (12:25 pm)
My approch to learning the GUI controls was to examine the various editors and break down how they were scripted. I had some trouble as well intitially but when I looked through the code it helped a great deal. It sounds like the option screen for setting your conifig would be very benificial to break down.- Jesse
#11
I've gotten through part of this so far. Here is what I did.
Created a customProfiles.cs as follows
and added an exec line in main.cs to include this script.
I then created a new .gui file using the Torque GUI editor.
Originally the file looked as follows:
I modified the MoveLeftButton to
I'm currently stuck with trying to figure out how to capture keyboard events. I could create an ActionMap that binds every key on the keyboard, but I'm thinking there may be a more elegant way to do this. What I'd like to do is be notified when a keyboard event occurs, then be able to look up what key has been pressed/released and use that to make a call to
eval ($currentButton @".setText (\"" @ %keyPressed @ "\");");
I'm thinking maybe the GuiInputCtrl object will do what I need, but if I add that control type to my GUI, Torque locks up and I am unable to do a .dump () on it.
So the current question then, is there a way to generically capture keyboard events outside of binding an actionmap to each and every key on the keyboard?
06/23/2006 (6:24 pm)
Update:I've gotten through part of this so far. Here is what I did.
Created a customProfiles.cs as follows
if (!isObject (GuiPlayerControlsTextProfile)) new GuiControlProfile (GuiPlayerControlsTextProfile : GuiButtonProfile)
{
justify = "center";
fontSize = 18;
fontColor = "255 255 255";
};and added an exec line in main.cs to include this script.
I then created a new .gui file using the Torque GUI editor.
Originally the file looked as follows:
//--- OBJECT WRITE BEGIN ---
new GuiBitmapCtrl(ControlsGUI) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
bitmap = "~/data/images/splashscreen";
wrap = "0";
new GuiBitmapButtonTextCtrl(MoveLeftButton) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "600 250";
Extent = "100 20";
MinExtent = "100 20";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "A";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "~/data/images/button.PNG";
};
};
//--- OBJECT WRITE END ---I modified the MoveLeftButton to
new GuiBitmapButtonTextCtrl(MoveLeftButton) {
canSaveDynamicFields = "0";
[b]Profile = "GuiPlayerControlsTextProfile";[/b]
HorizSizing = "right";
VertSizing = "bottom";
position = "600 250";
Extent = "100 20";
MinExtent = "100 20";
canSave = "1";
Visible = "1";
[b]Command = "$currentButton = \"MoveLeftButton\";";[/b]
hovertime = "1000";
text = "A";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "~/data/images/button.PNG";
};I'm currently stuck with trying to figure out how to capture keyboard events. I could create an ActionMap that binds every key on the keyboard, but I'm thinking there may be a more elegant way to do this. What I'd like to do is be notified when a keyboard event occurs, then be able to look up what key has been pressed/released and use that to make a call to
eval ($currentButton @".setText (\"" @ %keyPressed @ "\");");
I'm thinking maybe the GuiInputCtrl object will do what I need, but if I add that control type to my GUI, Torque locks up and I am unable to do a .dump () on it.
So the current question then, is there a way to generically capture keyboard events outside of binding an actionmap to each and every key on the keyboard?
#12
http://www.garagegames.com/mg/forums/result.thread.php?qt=46780
06/28/2006 (6:04 pm)
For those who may have been interested in a solution to this, I reposted this question in the Torque Core Questions forum. Made some progress but not quite there yet.http://www.garagegames.com/mg/forums/result.thread.php?qt=46780
Torque Owner Fucifer
http://tdn.garagegames.com/wiki/GUI/Profiles/ControlList
Did you look at these.