Game Development Community

Popping most recent dialog off the stack

by Jason "fireVein" Culwell · in Torque Game Engine · 08/09/2008 (6:43 pm) · 9 replies

Hey guys,

Is there a way to pop the most recent dialog off of the stack? Basically I am trying to do Canvas.popDialog(); but without specifying which dialog to pop off the stack. I have already tried Canvas.setContent(..). Any help or insight is greatly appreciated.

About the author

http://www.microdotproductions.com - I am a self taught programmer that has been hacking away at code for a little over 10 years now. I am a very passionate and persistent programmer, and gamer. I love challenges and problem solving.


#1
08/09/2008 (6:51 pm)
I don't think the canvas keeps track of that for you, but you can always do it yourself. Like maybe...

function Canvas::pushDialog( %gui )
{
   $lastDlg = %gui;
   Parent::pushDialog( %gui );
}

Canvas.popDialog($lastDlg);
#2
08/09/2008 (7:11 pm)
According to the source, if you want to pop the last one, just don't pass an argument:

Canvas.popDialog();
#3
08/09/2008 (7:48 pm)
Oops! You are correct Jaimi.
#4
08/09/2008 (9:54 pm)
Ya thats right, I was also searching for something like this, thanx.
#5
09/08/2008 (5:07 pm)
Sorry for such a late reply. I am having issues with "Canvas.popDialog();" it gives an error that says invalid control and won't pop the last dialog. Perhaps that is because I am using the console? I will double check and let you know. Thank you for the replies.
#6
09/08/2008 (5:27 pm)
Okay, I created a gui window, pushed it, and on this window I have a button that when clicked it calls Canvas.popDialog();.. the console says popDialog(): invalid control :

Anyone know whats up? I am using ArcaneFX CoreTech 1.0.2
#7
09/08/2008 (8:03 pm)
Which version of TGE are you using? I just looked at the 1.4.2 source code and if thats what you have, you should only see that message if you pass an argument to popDialog. If you call popDialog with no arguments, even if theres nothing to pop, you shouldn't see that message.
#8
09/08/2008 (9:33 pm)
I am using whichever version of TGE that ArcaneFX CoreTech 1.0.2 is using which I assume is 1.5.2.
#9
09/09/2008 (12:25 am)
I don't own that version of TGE. Very possible it got broken somewhere down the line. Perhaps take a look at the source, everyone likes people who submit bug fixes '-)