ctrlAddEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add magic variables)
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *H([a-z ])" to "$1 - h$2")
Line 28: Line 28:
|p1= control: [[Control]]
|p1= control: [[Control]]


|p2= handler: [[String]] - Handler name, see [[User Interface Event Handlers]]
|p2= handler: [[String]] - handler name, see [[User Interface Event Handlers]]


|p3= function: [[String]], since {{GVI|arma3|1.06}} also [[Code]] - script. Several [[Magic Variables]] are available:
|p3= function: [[String]], since {{GVI|arma3|1.06}} also [[Code]] - script. Several [[Magic Variables]] are available:

Revision as of 15:32, 8 November 2023

Hover & click on the images for description

Description

Description:
Add an event handler to the given control.
Groups:
GUI Control - Event HandlersEvent Handlers

Syntax

Syntax:
control ctrlAddEventHandler [handler, function]
Parameters:
control: Control
handler: String - handler name, see User Interface Event Handlers
function: String, since Arma 3 logo black.png1.06 also Code - script. Several Magic Variables are available:
  • Event Handler parameters are accessible via _this
  • The Event Handler type is available as _thisEvent
  • The Event Handler index is available as _thisEventHandler
Return Value:
Number - handler ID or -1 if failed

Examples

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

Additional Information

See also:
displayAddEventHandler ctrlRemoveEventHandler ctrlRemoveAllEventHandlers

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