GUIControl* GUI.Controls[index]
Provides an array which allows you to access controls on the GUI by their index. You should
not normally need to do this, since accessing the controls by their name is far easier;
however, if you need to interoperate with legacy code that uses the control number, this
can come in useful.
Returns the GUIControl object for the specified control index, or null if you
give an invalid control index.
You can cast the GUIControl to the appropriate type using the AsButton, AsListBox, etc
methods on it.
Example:
GUIControl *control = gInventory.Controls[4];
if (control == null) {
Display("The inventory GUI doesn't have a control number 4.");
}
else {
control.Enabled = true;
control.AsListBox.AddItem("New item!!");
}
gets list box number 4 from the INVENTORY GUI, and then adds an item to it.
If control 4 isn't a listbox, you will get a Null Reference error.
See Also: GUIControl.As*,
GUI.ControlCount
|