Game Development Community

Trouble with an if statement in gui

by Darkfire Games · in Torque Game Engine Advanced · 03/11/2007 (6:52 am) · 4 replies

Ok, so the optionsdlg.gui does not work, the top graphics pane doesnt turn invisible when the other panes are selected, so i set out to try and get it working.

If im incorrect in any assumption here please correct me.

I see that the 2 panes have the same name, OptGraphicsPane. The 2nd pane, the bottom, works fine, its the top that stays there, so i figure that its only applying visible to false at the start of optionsdlg.cs, to that last pane.

I make that last pane OptGraphicsPane1, and i add a line making that invisible in the cs file.

So, i make this if statement ( with rest of function )

function optionsDlg::setPane(%this, %pane)
{
   OptAudioPane.setVisible(false);
   OptGraphicsPane1.setVisible(false);
   OptGraphicsPane.setVisible(false);
   OptNetworkPane.setVisible(false);
   OptControlsPane.setVisible(false);
   
   if ( %pane == Graphics )
   {
       echo(%pane);
        ("Opt" @ %pane @ "Pane").setVisible(true);
        ("Opt" @ %pane @ "Pane1").setVisible(true);
        
   } else {
       
        ("Opt" @ %pane @ "Pane").setVisible(true);
   }
       
   OptRemapList.fillList();
}

Yet every single time, although this fixes the problem, i get an error saying OptAudioPane1 or OptControlPane1 cannot be found, i have put an echo statement in the condition, and even when its audio or control, the primary condition is being executed, i really cannot see how or why.

I have tried both Graphics and "Graphics" as the condition, no go.

#1
03/11/2007 (7:29 am)
Use $= to compare strings in Torque Script
#2
03/11/2007 (7:37 am)
/slaps head

Thank you
#3
03/11/2007 (8:47 am)
Don't worry I think we've all done stuff like that before :)
#4
03/11/2007 (9:00 am)
Use the search :-) I fixed this a while back. See here.