User Interface Event Handlers: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(DIK_KeyCodes links)
(Fix mistake - onButtonClicked should be onButtonClick)
Line 158: Line 158:
|-  
|-  
|  class="priority" | 1
|  class="priority" | 1
|  class="event" | onButtonClicked
|  class="event" | onButtonClick
|  class="fired" | The attached button action is performed.
|  class="fired" | The attached button action is performed.
|  class="notes" | Returns control.
|  class="notes" | Returns control.

Revision as of 02:27, 15 September 2008

Basic Overview

User Interface Event Handlers are given as values in the Dialog/Control classes (in the config.cpp or description.ext). The string next to the value is run as a line of script. An example line (this would be put within a control or dialog class):

onMouseDown = "hint str _this";

These events can also be given to dialogs/controls using the ctrlSetEventHandler scripting command. Important Note: When using the event names listed below with the ctrlSetEventHandler command, the preceding "on" in the name must be eliminated! (e.g. ButtonDown instead of onButtonDown)

The events pass data to their scripts in the _this array. Each event passes a different set of data (not listed in the below table). However, the control or display that the event was assigned to is always found in (_this select 0).

Reference List

Priority Event Fired Notes Scope
1 onLoad Display and all controls are created, but no action on any is taken. Returns the display. Display
1 onUnload Display is closed, but no controls are destroyed yet. Returns the display and exit code. Display
1 onChildDestroyed Child display is closed. Returns the display, which child display was closed and exit code. Display
1 onMouseEnter The mouse pointer enters the control area. Returns control. Control
1 onMouseExit The mouse pointer exits the control area. Returns control. Control
2 onSetFocus Input focus is on control. It now begins to accept keyboard input. Returns control. Control
2 onKillFocus Input focus is no longer on control. It no longer accepts keyboard input. Returns control. Control
3 onTimer After amount of time given by setTimer function. Returns control. Control
2 onKeyDown Pressing any keyboard key. Fired before the onKeyUp event. Returns the control, the keyboard code and the state of Shift, Ctrl and Alt. Control
2 onKeyUp Releasing any keyboard key. Fired after the onKeyDown event. Returns the control, the keyboard code and the state of Shift, Ctrl and Alt. Control
2 onChar When some readable characters is recognised. Returns the control and the char code. Control
2 onIMEChar When IME character is recognized (used in Korean and other eastern languages). Returns the control and the char code. Control
2 onIMEComposition When partial IME character is recognized (used in Korean and other eastern languages). Returns the control and the char code. Control
3 onJoystickButton Pressing and releasing any joystick button. Returns the control and the the pressed button. Control
2 onMouseButtonDown Pressing a mouse button. Followed by the onMouseButtonUp event. Returns the control, the pressed button, the x and y coordinates and the state of Shift, Ctrl and Alt. Control
2 onMouseButtonUp Releasing a mouse button. Follows the onMouseButtonDown event. Returns the control, the pressed button, the x and y coordinates and the state of Shift, Ctrl and Alt. Control
2 onMouseButtonClick Pressing and releasing a mouse button. Returns the control, the pressed button, the x and y coordinates and the state of Shift, Ctrl and Alt. Control
2 onMouseButtonDblClick Pressing and releasing a mouse button twice within very short time. Returns the control, the pressed button, the x and y coordinates and the state of Shift, Ctrl and Alt. Control
2 onMouseMoving Fires continuously while moving the mouse with a certain interval. Returns the control, the x and y coordinates and mouseOver. Control
2 onMouseHolding Fires continuously while mouse is not moving with a certain interval. Returns the control, the x and y coordinates and mouseOver. Control
2 onMouseZChanged Fires when mouse wheel position is changed. Returns the control and the change of the scrollbar. Control
3 onCanDestroy Ask this control if dialog can be closed (used for validation of contained data). Returns the control and exit code. Control
3 onDestroy Destroying control Returns the control and exit code. Control
1 onButtonClick The attached button action is performed. Returns control. Button
1 onButtonDown The left mouse button is pressed over the button area or a key on the keyboard is pressed. Returns control. Button
1 onButtonUp The left mouse buttons is released outside the button area and the attached button action is not performed. Returns control. Button
2 onLBSelChanged The selection in a listbox is changed. The left mouse button has been released and the new selection is fully made. Returns the control and the selected element index. Listbox
2 onLBListSelChanged Selection in XCombo box changed (but value is not stored yet). Returns the control and the selected element index. Listbox
2 onLBDblClick Double click on some row in listbox. Returns the control and the selected element index. Listbox
2 onLBDrag Drag & drop operation started. Returns the control and the selected element index. Listbox
2 onLBDragging Drag & drop operation is in progress. Returns the control and the x and y coordinates. Listbox
2 onLBDrop Drag & drop operation finished. Returns the control and the x and y coordinates. Listbox
2 onTreeSelChanged Changing the selection in a tree. Returns the control. Tree
2 onTreeDblClick Pressing and releasing twice on a tree. Returns the control. Tree
3 onTreeExpanded The tree folder structure has been expanded. Returns the control. Tree
3 onTreeCollapsed The tree folder structure has been collapsed. Returns the control. Tree
2 onToolBoxSelChanged Changed the selection in a toolbox. Returns the control and the selected element index. Toolbox
2 onCheckBoxesSelChanged Changed the selection in a checkbox. Returns the control, the selected element index and the current state. Checkbox
2 onHTMLLink Pressing and releasing a HTML link. Returns the control and href. HTML
2 onSliderPosChanged Changing the position of a slider. Returns the control and the change. Slider
2 onObjectMoved Moving an object. Returns the control and the offset on the x,y and z axes. Object
2 onMenuSelected Some item in context menu (used now only in new mission editor) was selected. Returns the control and the command id. Context menu