spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * GUI functions and properties

Controls property (GUI)

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


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.