ctrlAddEventHandler: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "\] +\[" to "] [") |
BrettMayson (talk | contribs) mNo edit summary |
||
Line 37: | Line 37: | ||
|r1= [[Number]] - handler ID or -1 if failed | |r1= [[Number]] - handler ID or -1 if failed | ||
|x1= <sqf>_map ctrlAddEventHandler [" | |x1= <sqf>_map ctrlAddEventHandler ["Draw", "_this call BIS_fnc_strategicMapOpen_draw"];</sqf> | ||
|x2= <sqf>_map ctrlAddEventHandler [" | |x2= <sqf>_map ctrlAddEventHandler ["Draw", { hintSilent str _this }];</sqf> | ||
|x3= <sqf>findDisplay 12 displayCtrl 51 ctrlAddEventHandler [" | |x3= <sqf>findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { hintSilent str _this }]; //Arma 3 map control</sqf> | ||
|seealso= [[displayAddEventHandler]] [[ctrlRemoveEventHandler]] [[ctrlRemoveAllEventHandlers]] | |seealso= [[displayAddEventHandler]] [[ctrlRemoveEventHandler]] [[ctrlRemoveAllEventHandlers]] | ||
}} | }} |
Latest revision as of 15:17, 7 October 2025
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
1.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:
- Example 3:
- findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { hintSilent str _this }]; //Arma 3 map control
Additional Information
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