Game Development Community

GuiControlArrayControl -- what is it?

by Kevin Rogers · in Torque Game Engine · 01/17/2006 (1:32 pm) · 11 replies

Hey guys,

Anybody know how and when this control is used? I can find absolutely no documentation for it.

Thanks!

#1
02/15/2006 (11:31 am)
Hey Kevin,

I wasn't able to find a 'GuiControlArrayControl' in the engine, so I'm assuming you're referring to the GuiArrayCtrl. GuiArrayCtrl is a parent class for many torque Gui elements. On its own, its not particularily exciting, but when sub-classed, you can create some interesting things with it.

Currently, GuiTreeViewCtrl, GuiTextListCtrl, GuiConsole, GuiTextListCtrl and DbgFileView (GuiDebugger) are all sub-classes of GuiArrayCtrl. Do you notice any similarities between all those classes? They all display and store text! GuiArrayCtrl is essentially a bunch of functions that allow storing, displaying and generally dealing with multiple text fields a whole lot easier... GuiArrayCtrl allows text to be arranged in 'cells' and each cell can be selected, moved and otherwise manipulated. GuiTextListCtrl extends this by adding sorting and a whole whack of other useful goodies.

I hope this will be able to get you started in using GuiArrayCtrl!

Stephane
#2
02/15/2006 (11:36 am)
I found reference to it in the GUI/Profiles/ControlList TDN article, but it wasn't filled out... Also Im pretty sure I saw it listed as a gui control in Torque 2D.

It is probably exactly what Stephane said :)
#3
02/15/2006 (11:45 am)
Thanks Stephane & Kevin,
I've wondered the same thing.

I have a few more specific Qs:

* can GuiArrayCtrl be adapted to contain generic GuiControls, not just text controls ?

* are GuiArrayCtrls always vertical ?


- basically i'd like to use these guys to contain a grid of buttons, or to contain pop-up menus which have both icons and text.

is this a good place to start, or should we just roll it ourselves w/ basic GuiControls ?
#4
02/15/2006 (8:06 pm)
Hey Orion,

First off, no, I don't believe GuiArrayCtrl can contain anything but text. It may be feasible to create a sub-class of GuiArrayCtrl to do what you want...

GuiArrayCtrls do not have to be just vertical. The join server menu in the sample game provided with Torque shows an example of GuiArrayCtrl being used with horizontal and vertical components.

I don't think GuiArrayCtrl can be used on its own, so to create your grid of buttons, you would have to create a sub-class of GuiArrayCtrl that allowed you to display buttons at each cell. GuiArrayCtrl is basically just some code to get you started with creating a grid/array-like GUI element.

I hope that helps!

Stephane
#5
02/15/2006 (9:24 pm)
Well first off: Thanks Stephane, for the info on GuiArrayCtrl. But I hate to say that it's a bit off the mark.

GuiControlArrayControl _is_ in the engine. To be specific, it is declared in "../gui/containers/guiCtrlArrayCtrl.h". From glancing over the code, it appears to provide functionality to hold child controls in a grid... It actiually looks like it might be what you're looking for, Orion, but I'm not seeing exactly how it would be used. =)

Now if someone (whoever coded the thing up?) would just give us some clues... =P
#6
02/15/2006 (11:53 pm)
Thanks Stephane and Kevin.

I guess i'll have to just try it.

I'm sure it can be wrangled if it's not already ready.
#7
02/16/2006 (12:46 pm)
@ Orion: I can't take the time to play with it right now, since I'm busy with other stuff... So, if you figure it out, definitely let us know, please! =)
#8
02/18/2006 (3:41 am)
Hey all,

My bad, I totally dropped the ball on that one... sorry. In Torque 1.4 (which I'm currently not using), there is most definitely a guiCtrlArrayCtrl (I'd like to know who came up with that name when there's already a guiArrayCtrl... :)) It also does look like it organizes Gui elements into a grid-like pattern.

All of my comments above do still apply to the guiArrayCtrl found in "../gui/guiArrayCtrl" in Torque 1.3 and "../gui/core/guiArrayCtrl" in Torque 1.4.

Sorry for any confusion/trouble I may have caused and thank you to Kevin for steering you back on course...

Cheers,

Stephane
#9
02/18/2006 (8:39 pm)
It's all good! Thanks for at least being willing to help, Stephane! =)
#10
05/11/2006 (6:25 pm)
I've just found - to make GuiControlArrayControl to work you need perform .resize for the control after you add all controls to it. It's not the same as GuiTextListCtrl, which automatically resized (rows) when placed in GuiScrollCtrl.
Btw, very nice and useful control..
#11
07/26/2006 (6:16 pm)
Wow, I'm a little late checking back here... Thanks for the info, bank! =)