ctrlAddEventHandler

From Bohemia Interactive Community
Revision as of 16:32, 18 January 2021 by R3vo (talk | contribs) (Text replacement - " <h3 style='display:none'>Bottom Section</h3>" to "")
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Add an event handler (User Interface Event Handlers) to the given control. Returns id of the handler or -1 when failed.

Control EHs are processed in reversed order, i.e. last added: first, first added: last. So if you have an override it should be set up in the 1st added EH.


When using the event names listed here with the ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands, the prefix "on" in the event name must be removed (e.g. 'ButtonDown' instead of 'onButtonDown').
Groups:
GUI Control - Event HandlersEvent Handlers

Syntax

Syntax:
control ctrlAddEventHandler [handler,function]
Parameters:
control: Control
[handler,function]: Array
handler: String - handler name
function: String or Code - script
Return Value:
Number

Examples

Example 1:
_map ctrlAddEventHandler ["draw","_this call BIS_fnc_strategicMapOpen_draw"];
Example 2:
_map ctrlAddEventHandler ["draw",{hintSilent str _this}];

Additional Information

See also:
displayAddEventHandlerctrlRemoveEventHandlerctrlRemoveAllEventHandlers

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on October 30, 2013 - 11:14
Killzone_Kid
As of Arma 3 v1.05.111658 ctrlAddEventHandler and displayAddEventHandler support script Code in addition to String [1]