Game Development Community

Updating a GUI control value

by Bruno · in Torque Game Builder · 05/10/2007 (12:19 pm) · 4 replies

Hello,

I have this GUI control GuiPopUpMenuCtrl, that it's like this :

new GuiPopUpMenuCtrl(OptGraphicsResolutionMenu2) {
canSaveDynamicFields = "0";
Profile = "GuiPopUpMenuProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "256 454";
Extent = "179 20";
MinExtent = "8 14";
canSave = "1";
Visible = "1";
tooltipprofile = "GuiDefaultProfile";
hovertime = "1000";
text = "640 480";
maxLength = "255";
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
};


So each time my games goes in, the user can pop it down, and change the resolution.
So, let's imagine the player chooses a resolution of 1024x768, he plays and exits.
The next time he gets into the game, the game will be at 1024x768(saved in the $prefs), but in the popup window it's still 640x480 written.

What i wanted to do, is simply to change the value of the combo box, i tried like this :

OptGraphicsResolutionMenu2.setText($pref::Video::Resolution);

and

OptGraphicsResolutionMenu2.setValue($pref::Video::Resolution);

but no luck.
How can i do this ??

thanks,
Bruno

#1
05/11/2007 (11:06 am)
Try

OptGraphicsResolutionMenu2.setSelected(OptGraphicsResolutionMenu2.findText($pref::Video::Resolution));
#2
05/11/2007 (11:19 am)
Nope, didn't work
#3
05/11/2007 (11:35 am)
Hmm, you sure the value in the pref matches the one listed, that same method I posted worked in my test cases using "option1" "option2" "option3" etc
#4
05/11/2007 (11:47 am)
What do you mean, it matches the one listed ?

$pref::Video::Resolution is the one found in common/preferences/pref.cs

OptGraphicsResolutionMenu2 is the datablock..

what do you mean ??