
Prototype: Control.SetEvent(EventMask, PythonFunction)

Description: Sets an event of a control on a window to a python function

Parameters: 
EventMask                  - a dword describing the event. Its high byte is actually the control's type.
PythonFunction             - the function object

Implemented events:
IE_GUI_BUTTON_ON_PRESS    = 0x00000000, the user pressed the button.
IE_GUI_MOUSE_OVER_BUTTON  = 0x00000001, the user hovered the mouse over the button.
IE_GUI_MOUSE_ENTER_BUTTON = 0x00000002, the user just moved the mouse onto the button.
IE_GUI_MOUSE_LEAVE_BUTTON = 0x00000003, the mouse just left the button
IE_GUI_BUTTON_ON_SHIFT_PRESS = 0x00000004, the button was pressed along with the shift key.
IE_GUI_BUTTON_ON_RIGHT_PRESS = 0x00000005, the button was right clicked
IE_GUI_BUTTON_ON_DRAG_DROP   = 0x00000006, the button was clicked during a drag&drop action.
IE_GUI_PROGRESS_END_REACHED = 0x01000000, the progressbar received a 100 percent value.
IE_GUI_SLIDER_ON_CHANGE   = 0x02000000, the slider's knob position has changed.
IE_GUI_EDIT_ON_CHANGE     = 0x03000000, the text in the editbox has changed.
IE_GUI_TEXTAREA_ON_CHANGE = 0x05000000, the text in the textarea has changed.
IE_GUI_LABEL_ON_PRESS     = 0x06000000, the label was pressed.
IE_GUI_SCROLLBAR_ON_CHANGE= 0x07000000, the scrollbar's knob position has changed.
.... (See GUIDefines.py for more event types)

Return value: N/A

Examples:
 Bar.SetEvent (IE_GUI_PROGRESS_END_REACHED, EndLoadScreen)
 ...
 def EndLoadScreen ():
        Skull = GemRB.GetControl (LoadScreen, 1)
        GemRB.SetButtonMOS (LoadScreen, Skull, "GSKULON")
The above example changes the image on the loadscreen when the progressbar reaches the end.

 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, Buttons.YesButton)
The above example sets up the 'YesButton' function from the Buttons module to be called when the button is pressed.

 Button.SetEvent (IE_GUI_MOUSE_OVER_BUTTON, ChaPress)
The above example shows how to implement 'context sensitive help'. The 'ChaPress' function displays a help text on the screen when you hover the mouse over a button.

See also: GetControl, SetVarAssoc, SetTimedEvent, accessing_gui_controls
