ctrlAddEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma2 | | arma2 | ||
|1.00 | |1.00 | ||
|gr1= GUI Control - Event Handlers | |gr1= GUI Control - Event Handlers | ||
|gr2= Event Handlers | |gr2= Event Handlers | ||
| Add an event handler ([[User Interface Event Handlers]]) to the given control. Returns id of the handler or -1 when failed.<br><br> | | Add an event handler ([[User Interface Event Handlers]]) to the given control. Returns id of the handler or -1 when failed.<br><br> | ||
{{ Important | 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.}} | {{ Important | 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.}} | ||
<br> | <br> | ||
{{Important|When using the event names listed [[User Interface Event Handlers|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'''').}} | {{Important|When using the event names listed [[User Interface Event Handlers|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'''').}} | ||
| control '''ctrlAddEventHandler''' [handler,function] | | control '''ctrlAddEventHandler''' [handler,function] | ||
|p1= control: [[Control]] | |p1= control: [[Control]] | ||
|p2= [handler,function]: [[Array]] | |p2= [handler,function]: [[Array]] | ||
|p3= handler: [[String]] - handler name | |p3= handler: [[String]] - handler name | ||
|p4= function: [[String]] or [[Code]] - script | |p4= function: [[String]] or [[Code]] - script | ||
| [[Number]] | | [[Number]] | ||
|x1= <code>_map [[ctrlAddEventHandler]] ["draw","_this call BIS_fnc_strategicMapOpen_draw"];</code> | |x1= <code>_map [[ctrlAddEventHandler]] ["draw","_this call BIS_fnc_strategicMapOpen_draw"];</code> | ||
|x2= <code>_map [[ctrlAddEventHandler]] ["draw",{[[hintSilent]] [[str]] _this}];</code> | |x2= <code>_map [[ctrlAddEventHandler]] ["draw",{[[hintSilent]] [[str]] _this}];</code> | ||
| [[displayAddEventHandler]], [[ctrlRemoveEventHandler]], [[ctrlRemoveAllEventHandlers]] | | [[displayAddEventHandler]], [[ctrlRemoveEventHandler]], [[ctrlRemoveAllEventHandlers]] | ||
| |MPBEHAVIOUR= | | |MPBEHAVIOUR= |
Revision as of 00:09, 18 January 2021
Description
- Description:
- Add an event handler (User Interface Event Handlers) to the given control. Returns id of the handler or -1 when failed.
- 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
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
Notes
- 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]