Game Development Community

Size of expanded GuiRolloutCtrl

by Rich Adam · in Torque 3D Professional · 04/02/2010 (5:55 pm) · 2 replies

I have a bunch of GuiRolloutCtrl's in a GuiStackControl. I create them dynamically and some have more control elements than others and therefore need to be different heights. I have set their initial extent to be what I desire. All of them are set to the same initial height. How do I set these extents individually?

When I collapse them and re-expand them the extent is WAAAY too small vertically, and not close to their initial vertical extent. How do I set the expanded extent for a GuiRolloutCtrl?

electromagnetically yours,
rda

#1
04/04/2010 (7:33 am)
Try adding all of your elements into a single guicontainer within the rollout control. You can then set the height dynamically when the rollout command is called based on the extend of the child guicontainer.
(ie mycontainer.setExtent(thechildcontrol.getExtent() + somemargin). This works well for me as I populate the control's innards dynamically.

Honestly, I stopped using the rollout control because of similar issues to yours. It seemed to be re-setting the height based on some other param I didnt want to invest the time to find although I spend significant time looking at the rollout controls usage in the different editors. Instead, I just built my own using torquescript and a basic guicontainer that does what I describe above with a guibuttoncontrol at the top to roll out/ roll in and do not use the rollout control (also does some other functionality that rollout control does not). I was probably using the rollout control incorrectly, but my solution is easier to troubleshoot and edit via script.
#2
04/04/2010 (9:00 pm)

GuiRolloutCtrl will only work correctly with a single child, so, as Jameson says, for putting multiple children into a GuiRolloutCtrl, you need to wrap them in a GuiControl (or other container class).

Also, it makes no sense to assign dimensions to a GuiRolloutCtrl as the control will automatically wrap itself around its child, resizing itself such that it's client area matches the child's extents and then putting a header on top of that.

So, in short, to size a rollout, size the content control it contains.