Data exchange between GUI controls and Global Dictionary Names.

Each control has an associated 'Value' which could be assigned to it by the SetVarAssoc command. The controls handle this value according to their type and subtype. To set a button's subtype, use the SetButtonFlags command.

Normal button: the associated variable will be set to the 'Value', other controls are unaffected.
CheckBox     : the associated variable will be or-ed with the value, other controls may change accordingly to the new value.
RadioButton  : the associated variable will be set to the 'Value', other controls are changed accordingly to the new value.

Progressbar: the progressbar will handle Value as a percentage (it can't alter the value).

Slider: the slider will handle Value as a scaling factor (not the actual position!), it will set the associated Variable to Position*Value.

TextEdit: cannot be associated with a variable. You have to use QueryText()

TextArea: cannot be associated with a variable, use the various TextArea commands.

Label: labels work like a normal button, the Value will be assigned to the associated variable when the label was 'pushed'.

ScrollBar: Value will be set based on the scrollbar's knob position. The scrollbar will be redrawn based on Value. If a textarea was associated to the ScrollBar (via the .chu) then the textarea will also be scrolled.

WorldMapControl: whether travel allowed or not (change the cursor)

MapControl: the mapcontrol will use the first bit of the associated value to display mapnotes.

Examples:
 Progress = 0
 GemRB.SetVar ("Progress", Progress)
 Bar = GemRB.GetControl (LoadScreen, 0)
 GemRB.SetVarAssoc (LoadScreen, Bar, "Progress", Progress)
Bar is a ProgressBar control, the engine will refresh the "Progress" Global Dictionary Variable as it progresses with the EnterGame command.

 GemRB.SetButtonFlags(FeedbackWindow,THac0RollsB, IE_GUI_BUTTON_CHECKBOX, OP_OR)
 GemRB.SetVarAssoc(FeedbackWindow,THac0RollsB, "Rolls",1)
The above commands (from the options screen) will change the "Rolls" variable according to the CheckBox' state.

 BppButtonB1 = GemRB.GetControl(GraphicsWindow, 5)
 BppButtonB2 = GemRB.GetControl(GraphicsWindow, 6)
 BppButtonB3 = GemRB.GetControl(GraphicsWindow, 7)
 GemRB.SetButtonFlags(GraphicsWindow, BppButtonB1, IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
 GemRB.SetButtonFlags(GraphicsWindow, BppButtonB2, IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
 GemRB.SetButtonFlags(GraphicsWindow, BppButtonB3, IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
 GemRB.SetVarAssoc(GraphicsWindow, BppButtonB1, "BitsPerPixel",16)
 GemRB.SetVarAssoc(GraphicsWindow, BppButtonB2, "BitsPerPixel",24)
 GemRB.SetVarAssoc(GraphicsWindow, BppButtonB3, "BitsPerPixel",32)
The above commands will set up the BPP selection RadioButton group.

See also: SetVarAssoc, SetVar, GetVar, QueryText, SetButtonFlags, accessing_gui_controls
