GUI element sorting weirdness
by Matias Kiviniemi · in Torque X 2D · 06/04/2007 (1:20 am) · 3 replies
Hi,
I have a GUISceneView control with a GUIBitmap and GUIText subcontrols, and I want to display them with the text on top. What I do is I create them both, set them to the GUISceneView and tell
In debugger I can see that this changes the GUIText to first one in GUIControl._objects
This has worked before, but for some reason the text is always under. I don't change the order in code after the creation, but are there other things that can affect the order of items (.Awaken()/.Sleep()). Or am I missing something else?
Matias
I have a GUISceneView control with a GUIBitmap and GUIText subcontrols, and I want to display them with the text on top. What I do is I create them both, set them to the GUISceneView and tell
GUISceneView.BringObjectToFront(GUIText);
In debugger I can see that this changes the GUIText to first one in GUIControl._objects
This has worked before, but for some reason the text is always under. I don't change the order in code after the creation, but are there other things that can affect the order of items (.Awaken()/.Sleep()). Or am I missing something else?
Matias
#2
What seems to have been the problem was actually the "BringObjectToFront" as it actually sends it to bottom (and PushObjectToBottom brings it to front)! So, setting the folder in a "deepest first-topmost last"-order sets them to a right order (in TorqueFolder._objects the last/topmpost has the highest index).
I'm not sure if the confusion is in me or Torque ;)
Matias
06/09/2007 (8:26 am)
Setting the GUIText folder to bitmap worked, but I actually have several bitmaps that get turned on/off depending on the state (it's a custom control). So I would have to swap the the folder dynamically, which worked but is a kind of a hairy solution.. What seems to have been the problem was actually the "BringObjectToFront" as it actually sends it to bottom (and PushObjectToBottom brings it to front)! So, setting the folder in a "deepest first-topmost last"-order sets them to a right order (in TorqueFolder._objects the last/topmpost has the highest index).
I'm not sure if the confusion is in me or Torque ;)
Matias
Torque Owner Thomas Buscaglia