Game Development Community

Embarrassingly Simple Question

by David Taylor · in Torque Game Builder · 11/24/2008 (3:50 pm) · 2 replies

Okay, so I've just spent the last couple of days getting back into TGB, and today I started fiddling with making a GUI.

It hasn't taken long for me to encounter a problem. I've created two GUIs - one is MainMenuGui.gui, and the other is CharacterSelect.gui.

Now, when I run my project, I tell it to do the following:
canvas.pushDialog(MainMenuGui);

It does that without a problem. This gui consists of buttons. On one button, I have given the following command:
canvas.popDialog(MainMenuGui); canvas.pushDialog(CharacterSelect);

It pops the MainMenuGui, and then does nothing more. In the console, it says
pushDialog(): Invalid control: CharacterSelect

I know that the button commands can take more than one line of code, and even if I ditch the canvas.popDialog piece of code and keep the latter canvas.pushDialog, I get the same error.

I've double checked that both GUIs are in the same gui folder, and both are called in the exec calls in main.cs.

I'm sure there must be some inexplicably simple explanation as to why I can push one GUI and not the other, but I can't think what it might be. Can anyone suggest a potential solution?

#1
11/24/2008 (3:54 pm)
It appears as if the object "CharacterSelect" hasn't been created.

Make sure that you exec() the gui file that you store it in.
#2
11/24/2008 (4:39 pm)
I did exec() it, but your response triggered the solution.

Even though the file itself is called "CharacterSelect", I'd initially named it "CharacterSelectGui" in the GUI Builder. So, canvas.pushDialog(CharacterSelectGui); does the trick.

Thanks!