Game Development Community

Bringing one gui object up over another?

by Dean · in Torque Game Engine · 07/11/2007 (10:58 am) · 3 replies

For some reason I can't find the answer to this, although its probably pretty simple. I noticed that gui objects with higher ID numbers are "higher" than the ones below. I want to be able to change which control is on top of another. I'm not sure how.... maybe i set the layer or alter the ID numbers of the controls?

#1
07/11/2007 (11:38 am)
Counterintuitively, to bring a control to the front, call pushToBack().

if %ctrl is contained in parent ctrl %parent, do %parent.pushToBack(%ctrl);
#2
07/11/2007 (12:05 pm)
Thanks. got that to work. but that created another problem for me... originally in my code i was having it determine which control was on top by using the id number.

if (DDBCtrl->getId() > finalid)


what should I use now?
#3
07/11/2007 (4:20 pm)
%parent.getObject(0) will return either the top or bottom control,
and %parent.getObject(%parent.getCount() - 1) will return either the bottom or the top.

both of those should be inside a check on if (parent.getCount() > 0), of course.

note: GuiControls are SimGroups,
and thus inherit all those methods.