===== Accessing GUI controls =====

To access a GUI control, you must know its window ID and control ID (CHU index). You must use LoadWindow and GetControl to obtain the control. Inspect the relevant CHU file to find all the control IDs.

Usually a GUI command works only on one type of controls. A wrong control type will cause a Runtime Error and terminates the GUI script (not the game or the engine).

**Example:**

    StartWindow = GemRB.LoadWindow (7)
    Label = StartWindow.GetControl (0x0fff0000)
    Label.SetText (GEMRB_VERSION)

In the above example we load a window whose window ID is 7 and its child control with ID 0xfff0000. Finally, we use a predefined constant to set the control's text.

[[guiscript:index|Function index]]
