Game Development Community

simple GUI question

by Donald Teal · in Torque 3D Professional · 03/26/2010 (8:18 am) · 6 replies

I have a problem closing a GuiWindowCtrl. trying to have a button close the window and return to the main menu. not using the 'x' in the top right corner of the window. what is the command to close the window and return to the previous or otherwise declared menu?

#1
03/26/2010 (8:40 am)
To close a gui/window use
canvas.popDialog(GuiName);
where GuiName is whatever your gui is named. (note: gui name is declared in the .gui file where it says "new GuiControl(GuiName)")

Ryan did a more detailed explanation than me O_o
#2
03/26/2010 (8:42 am)
You use the Canvas to show gui's, but it also depends on what you are trying to do. If you want a gui as a dialog then you would use Canvas.pushDialog(yourguiname) and use Canvas.popDialog(yourguiname) to remove it. If you want to show an entirely different gui then you use Canvas.setContent(yourguiname). Take a look at the function loadMainMenu and the option dialog for examples.
#3
03/26/2010 (8:59 am)
ok thanks alot. was trying to use canvas.pushDialog(); to just reopen the previous menu. canvas.popDialog(); does the trick.


here is another question that might not be so simple.
what is the best approach to setting up a character select that the character selected determines the team and spawn point of the player. I am guessing one player would host the server then would have the char select screen for him to select character and then enter the server at spawner determined by char selected. gonna have 2 rival races as each team. now people who join the server would need the char select screen to come up after joining server but before mission starts. Anyone know of any tutorials that might help with this or can help with it?
#4
03/26/2010 (9:11 am)
Sean Rice just ported over the teams resource to T3D (Here). That should point you in the right direction.
#5
03/26/2010 (9:17 am)
thanks I will check it out.
#6
03/26/2010 (10:06 am)
Depending on what your going for, you could execute "window.setVisible(bool)" from closeCommand.