User Interface Event Handlers: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 12: Line 12:
|-  
|-  
|  class="priority" | 1
|  class="priority" | 1
|  class="event" | onLoad
|  class="event" | onButtonClick
|  class="fired" | Fires when UI container is created, but no action is taken. onLoad event for display fires '''after''' onLoad events for all controls it contains are fired.  
|  class="fired" | The attached button action is performed. When returned value is [[true]], button's display remains opened.
|  class="notes" | Returns the display or control.
|  class="notes" | Returns control.
|  class="scope" | Display, Control
|  class="scope" | Button
|-  
|-  
|  class="priority" | ?
|  class="event" | onButtonDblClick
|  class="fired" | ?
|  class="notes" | Arma 3
|  class="scope" | Button
|- <span idonButtonDown"/>
|  class="priority" | 1
|  class="priority" | 1
|  class="event" | onUnload
|  class="event" | onButtonDown
|  class="fired" | Display is closed, but no controls are destroyed yet. '''NOTE:''' onUnload event doesn't fire for RscTitles displays started with [[cutRsc]]
|  class="fired" | The left mouse button is pressed over the button area or a key on the keyboard is pressed.
|  class="notes" | Returns the display and exit code.
|  class="notes" | Returns control.
|  class="scope" | Display
|  class="scope" | Button
|- <span idonButtonUp"/>
|  class="priority" | 1
|  class="event" | onButtonUp
|  class="fired" | The left mouse buttons is released outside the button area and the attached button action is not performed.
|  class="notes" | Returns control.
|  class="scope" | Button
|-
|  class="priority" | 3
|  class="event" | onCanDestroy
|  class="fired" | Ask this control if dialog can be closed (used for validation of contained data).
|  class="notes" | Returns the control and exit code.
|  class="scope" | Control
|-
|  class="priority" | 2
|  class="event" | onChar
|  class="fired" | When some readable characters is recognised.
|  class="notes" | Returns the control and the char code.
|  class="scope" | Control
|-
|  class="priority" | ?
|  class="event" | onChecked
|  class="fired" | CheckBox checked
|  class="notes" | Arma 3
|  class="scope" | Checkbox
|-
|  class="priority" | ?
|  class="event" | onCheckedChanged
|  class="fired" | Checked state of CheckBox changed.
|  class="notes" | Arma 3. Returns control and the checked state (0 or 1, not boolean).
|  class="scope" | Checkbox
|-
|  class="priority" | 2
|  class="event" | onCheckBoxesSelChanged
|  class="fired" | Changed the selection in a checkbox.
|  class="notes" | Returns the control, the selected element index and the current state.
|  class="scope" | Checkbox
|-  
|-  
|  class="priority" | 1
|  class="priority" | 1
Line 29: Line 71:
|  class="scope" | Display
|  class="scope" | Display
|-  
|-  
|  class="priority" | 1
|  class="priority" | 3
|  class="event" | onMouseEnter
|  class="event" | onDestroy
|  class="fired" | The mouse pointer enters the control area.
|  class="fired" | Destroying control
|  class="notes" | Returns control.
|  class="notes" | Returns the control and exit code.
|  class="scope" | Control
|  class="scope" | Control
|-  
|-  
|  class="priority" | 1
|  class="priority" | ?
|  class="event" | onMouseExit
|  class="event" | onDraw
|  class="fired" | The mouse pointer exits the control area.
|  class="fired" | Fires when the map is drawn (can occur more than once per second).
|  class="notes" | Returns control.
|  class="notes" | Returns the map control.
|  class="scope" | Control
|  class="scope" | Map
|-
|  class="priority" | 2
|  class="event" | onHTMLLink
|  class="fired" | Pressing and releasing a HTML link.
|  class="notes" | Returns the control and href.
|  class="scope" | HTML
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onSetFocus
|  class="event" | onIMEChar
|  class="fired" | Input focus is on control. It now begins to accept keyboard input.
|  class="fired" | When IME character is recognized (used in Korean and other eastern languages).
|  class="notes" | Returns control.
|  class="notes" | Returns the control and the char code.
|  class="scope" | Control
|  class="scope" | Control
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onKillFocus
|  class="event" | onIMEComposition
|  class="fired" | Input focus is no longer on control. It no longer accepts keyboard input.
|  class="fired" | When partial IME character is recognized (used in Korean and other eastern languages).
|  class="notes" | Returns control.
|  class="notes" | Returns the control and the char code.
|  class="scope" | Control
|  class="scope" | Control
|-  
|-  
|  class="priority" | 3
|  class="priority" | 3
|  class="event" | onTimer
|  class="event" | onJoystickButton
|  class="fired" | After amount of time given by setTimer function.
|  class="fired" | Pressing and releasing any joystick button.
|  class="notes" | Returns control.
|  class="notes" | '''Not in Arma 2 or Arma 3''' Returns the control and the the pressed button.
|  class="scope" | Control
|  class="scope" | Control
|- <span idonKeyDown"/>
|- <span idonKeyDown"/>
Line 70: Line 118:
|  class="notes" | Returns the control, the [[DIK_KeyCodes|keyboard code]] and the state of Shift, Ctrl and Alt.
|  class="notes" | Returns the control, the [[DIK_KeyCodes|keyboard code]] and the state of Shift, Ctrl and Alt.
|  class="scope" | Display, Control
|  class="scope" | Display, Control
|-
|  class="priority" | 2
|  class="event" | onKillFocus
|  class="fired" | Input focus is no longer on control. It no longer accepts keyboard input.
|  class="notes" | Returns control.
|  class="scope" | Control
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onChar
|  class="event" | onLBSelChanged
|  class="fired" | When some readable characters is recognised.
|  class="fired" | The selection in a listbox is changed. The left mouse button has been released and the new selection is fully made.
|  class="notes" | Returns the control and the char code.
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Control
|  class="scope" | Listbox,Combobox
|-
|  class="priority" | 2
|  class="event" | onLBListSelChanged
|  class="fired" | Selection in XCombo box changed (but value is not stored yet).
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Listbox
|-
|  class="priority" | 2
|  class="event" | onLBDblClick
|  class="fired" | Double click on some row in listbox.
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Listbox
|-
|  class="priority" | 2
|  class="event" | onLBDrag
|  class="fired" | Drag & drop operation started.
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Listbox
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onIMEChar
|  class="event" | onLBDragging
|  class="fired" | When IME character is recognized (used in Korean and other eastern languages).
|  class="fired" | Drag & drop operation is in progress.
|  class="notes" | Returns the control and the char code.
|  class="notes" | Returns the control and the x and y coordinates.
|  class="scope" | Control
|  class="scope" | Listbox
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onIMEComposition
|  class="event" | onLBDrop
|  class="fired" | When partial IME character is recognized (used in Korean and other eastern languages).
|  class="fired" | Drag & drop operation finished.
|  class="notes" | Returns the control and the char code.
|  class="notes" | Returns the control and the x and y coordinates.When the Listbox is inside a ctrlGroup the eventhandler need to be added to the ctrlGroup
|  class="scope" | Control
|  class="scope" | Listbox, Combobox, Textbox, ActiveText, Button
|-
|  class="priority" | 1
|  class="event" | onLoad
|  class="fired" | Fires when UI container is created, but no action is taken. onLoad event for display fires '''after''' onLoad events for all controls it contains are fired.  
|  class="notes" | Returns the display or control.
|  class="scope" | Display, Control
|-  
|-  
|  class="priority" | 3
|  class="priority" | 2
|  class="event" | onJoystickButton
|  class="event" | onMenuSelected
|  class="fired" | Pressing and releasing any joystick button.
|  class="fired" | Some item in context menu (used now only in new mission editor) was selected.
|  class="notes" | '''Not in Arma 2 or Arma 3''' Returns the control and the the pressed button.
|  class="notes" | Returns the control and the command id.
|  class="scope" | Control
|  class="scope" | Context menu
|- <span idonMouseButtonDown"/>
|- <span idonMouseButtonDown"/>
|  class="priority" | 2
|  class="priority" | 2
Line 127: Line 205:
| class="notes" | Returns the display, the <u>some kind of x and y delta position</u>.
| class="notes" | Returns the display, the <u>some kind of x and y delta position</u>.
| class="scope" | Display
| class="scope" | Display
|-
|  class="priority" | 1
|  class="event" | onMouseEnter
|  class="fired" | The mouse pointer enters the control area.
|  class="notes" | Returns control.
|  class="scope" | Control
|-
|  class="priority" | 1
|  class="event" | onMouseExit
|  class="fired" | The mouse pointer exits the control area.
|  class="notes" | Returns control.
|  class="scope" | Control
|-
|-
|  class="priority" | 2
|  class="priority" | 2
Line 140: Line 230:
|  class="scope" | Control only
|  class="scope" | Control only
|-  
|-  
|  class="priority" | 3
|  class="priority" | 2
|  class="event" | onCanDestroy
|  class="event" | onObjectMoved
|  class="fired" | Ask this control if dialog can be closed (used for validation of contained data).
|  class="fired" | Moving an object.
|  class="notes" | Returns the control and exit code.
|  class="notes" | Returns the control and the offset on the x, y and z axes.
|  class="scope" | Object
|-
|  class="priority" | 2
|  class="event" | onSetFocus
|  class="fired" | Input focus is on control. It now begins to accept keyboard input.
|  class="notes" | Returns control.
|  class="scope" | Control
|  class="scope" | Control
|-  
|-  
|  class="priority" | 3
|  class="priority" | 3
|  class="event" | onDestroy
|  class="event" | onTimer
|  class="fired" | Destroying control
|  class="fired" | After amount of time given by setTimer function.
|  class="notes" | Returns the control and exit code.
|  class="notes" | Returns control.
|  class="scope" | Control
|  class="scope" | Control
|-  
|-  
|  class="priority" | 1
|  class="priority" | 1
|  class="event" | onButtonClick
|  class="event" | onUnload
|  class="fired" | The attached button action is performed. When returned value is [[true]], button's display remains opened.
|  class="fired" | Display is closed, but no controls are destroyed yet. '''NOTE:''' onUnload event doesn't fire for RscTitles displays started with [[cutRsc]]  
|  class="notes" | Returns control.
|  class="notes" | Returns the display and exit code.
|  class="scope" | Button
|  class="scope" | Display
|-
|  class="priority" | ?
|  class="event" | onButtonDblClick
|  class="fired" | ?
|  class="notes" | Arma 3
|  class="scope" | Button
|- <span idonButtonDown"/>
|  class="priority" | 1
|  class="event" | onButtonDown
|  class="fired" | The left mouse button is pressed over the button area or a key on the keyboard is pressed.
|  class="notes" | Returns control.
|  class="scope" | Button
|- <span idonButtonUp"/>
|  class="priority" | 1
|  class="event" | onButtonUp
|  class="fired" | The left mouse buttons is released outside the button area and the attached button action is not performed.
|  class="notes" | Returns control.
|  class="scope" | Button
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onLBSelChanged
|  class="event" | onSliderPosChanged
|  class="fired" | The selection in a listbox is changed. The left mouse button has been released and the new selection is fully made.
|  class="fired" | Changing the position of a slider.
|  class="notes" | Returns the control and the selected element index.
|  class="notes" | Returns the control and the change.
|  class="scope" | Listbox,Combobox
|  class="scope" | Slider
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onLBListSelChanged
|  class="event" | onToolBoxSelChanged
|  class="fired" | Selection in XCombo box changed (but value is not stored yet).
|  class="fired" | Changed the selection in a toolbox.
|  class="notes" | Returns the control and the selected element index.
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Listbox
|  class="scope" | Toolbox
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onLBDblClick
|  class="event" | onTreeLButtonDown
|  class="fired" | Double click on some row in listbox.
|  class="fired" | Pressing and releasing left mouse button on a tree.
|  class="notes" | Returns the control and the selected element index.
|  class="notes" | Returns the control.
|  class="scope" | Listbox
|-
|  class="priority" | 2
|  class="event" | onLBDrag
|  class="fired" | Drag & drop operation started.
|  class="notes" | Returns the control and the selected element index.
|  class="scope" | Listbox
|-
|  class="priority" | 2
|  class="event" | onLBDragging
|  class="fired" | Drag & drop operation is in progress.
|  class="notes" | Returns the control and the x and y coordinates.
|  class="scope" | Listbox
|-
|  class="priority" | 2
|  class="event" | onLBDrop
|  class="fired" | Drag & drop operation finished.
|  class="notes" | Returns the control and the x and y coordinates.When the Listbox is inside a ctrlGroup the eventhandler need to be added to the ctrlGroup
|  class="scope" | Listbox, Combobox, Textbox, ActiveText, Button
|-
|  class="priority" | 2
|  class="event" | onTreeSelChanged
|  class="fired" | Changing the selection in a tree.
|  class="notes" | Returns the control and the new selection path.
|  class="scope" | Tree
|  class="scope" | Tree
|-  
|-  
|  class="priority" | 2
|  class="priority" | 3
|  class="event" | onTreeLButtonDown
|  class="event" | onTreeCollapsed
|  class="fired" | Pressing and releasing left mouse button on a tree.
|  class="fired" | The tree folder structure has been collapsed.
|  class="notes" | Returns the control.
|  class="notes" | Returns the control.
|  class="scope" | Tree
|  class="scope" | Tree
Line 233: Line 287:
|  class="event" | onTreeExpanded
|  class="event" | onTreeExpanded
|  class="fired" | The tree folder structure has been expanded.
|  class="fired" | The tree folder structure has been expanded.
|  class="notes" | Returns the control.
|  class="scope" | Tree
|-
|  class="priority" | 3
|  class="event" | onTreeCollapsed
|  class="fired" | The tree folder structure has been collapsed.
|  class="notes" | Returns the control.
|  class="notes" | Returns the control.
|  class="scope" | Tree
|  class="scope" | Tree
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onTreeMouseMove
|  class="event" | onTreeMouseExit
|  class="fired" | Fires continuously while moving the mouse with a certain interval.
|  class="fired" | The mouse pointer exits the tree control area
|  class="notes" | Returns the control.
|  class="notes" | Returns the control.
|  class="scope" | Tree
|  class="scope" | Tree
Line 255: Line 303:
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onTreeMouseExit
|  class="event" | onTreeMouseMove
|  class="fired" | The mouse pointer exits the tree control area
|  class="fired" | Fires continuously while moving the mouse with a certain interval.
|  class="notes" | Returns the control.
|  class="notes" | Returns the control.
|  class="scope" | Tree
|  class="scope" | Tree
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2
|  class="event" | onToolBoxSelChanged
|  class="event" | onTreeSelChanged
|  class="fired" | Changed the selection in a toolbox.
|  class="fired" | Changing the selection in a tree.
|  class="notes" | Returns the control and the selected element index.
|  class="notes" | Returns the control and the new selection path.
|  class="scope" | Toolbox
|  class="scope" | Tree
|-
|  class="priority" | ?
|  class="event" | onChecked
|  class="fired" | CheckBox checked
|  class="notes" | Arma 3
|  class="scope" | Checkbox
|-
|  class="priority" | ?
|  class="event" | onCheckedChanged
|  class="fired" | Checked state of CheckBox changed.
|  class="notes" | Arma 3. Returns control and the checked state (0 or 1, not boolean).
|  class="scope" | Checkbox
|-
|  class="priority" | 2
|  class="event" | onCheckBoxesSelChanged
|  class="fired" | Changed the selection in a checkbox.
|  class="notes" | Returns the control, the selected element index and the current state.
|  class="scope" | Checkbox
|-
|  class="priority" | 2
|  class="event" | onHTMLLink
|  class="fired" | Pressing and releasing a HTML link.
|  class="notes" | Returns the control and href.
|  class="scope" | HTML
|-
|  class="priority" | 2
|  class="event" | onSliderPosChanged
|  class="fired" | Changing the position of a slider.
|  class="notes" | Returns the control and the change.
|  class="scope" | Slider
|-
|  class="priority" | 2
|  class="event" | onObjectMoved
|  class="fired" | Moving an object.
|  class="notes" | Returns the control and the offset on the x, y and z axes.
|  class="scope" | Object
|-
|  class="priority" | 2
|  class="event" | onMenuSelected
|  class="fired" | Some item in context menu (used now only in new mission editor) was selected.
|  class="notes" | Returns the control and the command id.
|  class="scope" | Context menu
|-
|  class="priority" | ?
|  class="event" | onDraw
|  class="fired" | Fires when the map is drawn (can occur more than once per second).
|  class="notes" | Returns the map control.
|  class="scope" | Map
|-  
|-  
|  class="priority" | 2
|  class="priority" | 2

Revision as of 18:05, 18 June 2017

User Interface Event handlers allow you to automatically monitor and then execute custom code upon particular UI events being triggered.

Reference List

When using the event names listed below with the ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands, the prefix "on" in the name must be removed. (e.g. 'ButtonDown' instead of 'onButtonDown')
Priority Event Fired Notes and Parameters Scope
1 onButtonClick The attached button action is performed. When returned value is true, button's display remains opened. Returns control. Button
? onButtonDblClick ? Arma 3 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
3 onCanDestroy Ask this control if dialog can be closed (used for validation of contained data). Returns the control and exit code. Control
2 onChar When some readable characters is recognised. Returns the control and the char code. Control
? onChecked CheckBox checked Arma 3 Checkbox
? onCheckedChanged Checked state of CheckBox changed. Arma 3. Returns control and the checked state (0 or 1, not boolean). Checkbox
2 onCheckBoxesSelChanged Changed the selection in a checkbox. Returns the control, the selected element index and the current state. Checkbox
1 onChildDestroyed Child display is closed. Returns the display, which child display was closed and exit code. Display
3 onDestroy Destroying control Returns the control and exit code. Control
? onDraw Fires when the map is drawn (can occur more than once per second). Returns the map control. Map
2 onHTMLLink Pressing and releasing a HTML link. Returns the control and href. HTML
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. Not in Arma 2 or Arma 3 Returns the control and the the pressed button. 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. Display, 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. Display, Control
2 onKillFocus Input focus is no longer on control. It no longer accepts keyboard input. Returns control. Control
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,Combobox
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.When the Listbox is inside a ctrlGroup the eventhandler need to be added to the ctrlGroup Listbox, Combobox, Textbox, ActiveText, Button
1 onLoad Fires when UI container is created, but no action is taken. onLoad event for display fires after onLoad events for all controls it contains are fired. Returns the display or control. Display, Control
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
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. ListBox, ComboBox, TextBox, Button, ActiveText
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 relative to control and mouseOver. Control
Returns the display, the some kind of x and y delta position. 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 onMouseHolding Fires continuously while mouse is not moving with a certain interval. Returns the control, the x and y coordinates and mouseOver. If used with a display, the mouseOver parameter is excluded. Control
2 onMouseZChanged Fires when mouse wheel position is changed. Does not fire on disabled control. Checked with CT_EDIT type in v1.50. Returns the control and the change of the scrollbar. Control only
2 onObjectMoved Moving an object. Returns the control and the offset on the x, y and z axes. Object
2 onSetFocus Input focus is on control. It now begins to accept keyboard input. Returns control. Control
3 onTimer After amount of time given by setTimer function. Returns control. Control
1 onUnload Display is closed, but no controls are destroyed yet. NOTE: onUnload event doesn't fire for RscTitles displays started with cutRsc Returns the display and exit code. Display
2 onSliderPosChanged Changing the position of a slider. Returns the control and the change. Slider
2 onToolBoxSelChanged Changed the selection in a toolbox. Returns the control and the selected element index. Toolbox
2 onTreeLButtonDown Pressing and releasing left mouse button on a tree. Returns the control. Tree
3 onTreeCollapsed The tree folder structure has been collapsed. Returns the control. Tree
2 onTreeDblClick Pressing and releasing twice on a tree entry. Returns the control and the current selection path. Tree
3 onTreeExpanded The tree folder structure has been expanded. Returns the control. Tree
2 onTreeMouseExit The mouse pointer exits the tree control area Returns the control. Tree
2 onTreeMouseHold Fires continuously while mouse is not moving with a certain interval. Returns the control. Tree
2 onTreeMouseMove Fires continuously while moving the mouse with a certain interval. Returns the control. Tree
2 onTreeSelChanged Changing the selection in a tree. Returns the control and the new selection path. Tree
2 onVideoStopped A2 OA Logo.png1.56
Activated every time video ends (when looped, handler is executed after every finished loop).
Returns the control Control

Event parameters

The events handlers receive parameters in the _this variable. Each event passes a different set of parameters (listed in the table above) in an array. The control or display that the event was assigned to is always found in _this select 0.

Scope

In ArmA, most control-specific events work for controls and do not work for displays. The 2 exceptions being: onKeyDown and onKeyUp.

Since Arma 2, most control-specific events now work for both displays and controls.

Defining events

User Interface Event Handlers can be assigned in two ways: via class property definitions or via scripting commands.

Class defined events

Events can be defined in the Dialog (display) or Control classes (in config.cpp or description.ext). The event property value (string) is executed as a line of code. An example line (this would be put within a control or dialog class):

onMouseDown = "hint str _this";

Example:

class RscControlsGroup {
    type = 15;
    idc = -1;
    style = 0;
    x = 0;
    y = 0;
    w = 1;
    h = 1;
    
    class VScrollbar {
        color[] = {1,1,1,1};
        width = 0.021000;
        autoScrollSpeed = -1;
        autoScrollDelay = 5;
        autoScrollRewind = 0;
    };
    
    class HScrollbar {
        color[] = {1, 1, 1, 1};
        height = 0.028;
    };

    class ScrollBar { //for ARMA 2
        color[] = {1,1,1,0.600000};
        colorActive[] = {1,1,1,1};
        colorDisabled[] = {1,1,1,0.300000};
        thumb = "#(argb,8,8,3)color(1,1,1,1)";
        arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
        arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
        border = "#(argb,8,8,3)color(1,1,1,1)";
    };
    
    class Controls {};
};

class mouseHandler: RscControlsGroup {          
    onMouseHolding = "[0,_this] call Axx";
    onMouseButtonDown = "[1,_this] call Axx";
    onMouseButtonUp = "[2,_this] call Axx";
    onMouseZChanged = "[3,_this] call Axx";    
    onMouseEnter = "[4,_this] call Axx";    
    idc = 123;
    x = 0.0;
    y = 0.0;
    w = 1.0;
    h = 1.0;            
    colorBackground[] = {0.2, 0.0, 0.0, 0.0};
};

Script defined events

These events can also be given to dialogs/controls using the ctrlSetEventHandler scripting command. For the event handler to be called enable the control using the ctrlEnable scripting command.

(findDisplay 46) displayAddEventHandler ["keyDown", "_this call functionName_keyDown"];

functionName_keyDown = {   params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];     private _handled = false;     if (!_shift && !_ctrlKey && !_alt) then {   if (_dikCode in (actionKeys "NetworkStats")) then {   [] execVM "path\script.sqf";   _handled = true;   };   };     _handled; };

Demo mission

For VBS2 users, a demo mission is available here.