Canvas push/pop
by Howard Dortch · in Torque Game Engine · 11/07/2004 (4:05 am) · 3 replies
Can someone explain the difference or advantage of doing Canvas.pushDialog(dlg) and Canvas.popDialog(dlg) versus Canvas.setContent(dlg).
#2
if you push lots of things without the pop then you have a stack problem if this truely acts like a stack with push/pop.
I have buttons selected in a dialog and when I use the push/pop to go to other dialogs when I return, the buttons are still depressed. Seems the setContent() clears the buttons where the push/pop doesn't
I see what you mean by push a dialog on a canvas, like if I have a background the dialog only overlays whereas the setContent wipes the background.
11/07/2004 (4:42 am)
That would make sense. So setContent() "resets" or clears old canvas content with no memory leaks?if you push lots of things without the pop then you have a stack problem if this truely acts like a stack with push/pop.
I have buttons selected in a dialog and when I use the push/pop to go to other dialogs when I return, the buttons are still depressed. Seems the setContent() clears the buttons where the push/pop doesn't
I see what you mean by push a dialog on a canvas, like if I have a background the dialog only overlays whereas the setContent wipes the background.
#3
You can also use setVisibility() to toggle the visibility of dialogs that are in the gui, or you can use canvas.getContent().add() and .remove() functions, which I've done also, for cases where you want to add and remove gui elements from the current gui. The add() and remove() act like the push and pop functions except that since it's part of the gui, you have access to the other gui elements that would have been "under" them. setVisibility does the same thing, but the element is always part of the gui.
Hope that clears it up a bit for you...
11/07/2004 (5:32 am)
Pushing a dialog to the screen puts it on the top layer, so that you can't interact with the other gui elements. If you use setContent(), then the canvas is set to that element alone.You can also use setVisibility() to toggle the visibility of dialogs that are in the gui, or you can use canvas.getContent().add() and .remove() functions, which I've done also, for cases where you want to add and remove gui elements from the current gui. The add() and remove() act like the push and pop functions except that since it's part of the gui, you have access to the other gui elements that would have been "under" them. setVisibility does the same thing, but the element is always part of the gui.
Hope that clears it up a bit for you...
Torque Owner Stefan Lundmark
Obviously popDialog(); is just a way to close a dialog without resetting the canvas 100 %.