ctrlAddEventHandler: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "v1\.05\.[0-9]{6}" to "v1.06") |
m (formatting) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma2 | |game1= arma2 | ||
|1.00 | |version1= 1.00 | ||
| | |game2= arma2oa | ||
| | |version2= 1.51 | ||
| | |game3= tkoh | ||
| | |version3= 1.00 | ||
| | |game4= arma3 | ||
| | |version4= 0.50 | ||
| | |gr1= GUI Control - Event Handlers | ||
| | |gr2= Event Handlers | ||
| | |descr= Add an event handler to the given control. | ||
| | {{Feature|important| | ||
* Control event handlers 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 [[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''''). | |||
}} | }} | ||
|s1= control '''ctrlAddEventHandler''' [handler, function] | |||
|p1= control: [[Control]] | |||
|p2= handler: [[String]] - Handler name, see [[User Interface Event Handlers]] | |||
|p3= function: [[String]], since {{GVI|arma3|1.06}} also [[Code]] - Script | |||
|r1= [[Number]] - Handler ID or -1 if failed | |||
< | |x1= <code>_map [[ctrlAddEventHandler]] ["draw", "_this [[call]] BIS_fnc_strategicMapOpen_draw"];</code> | ||
</ | |||
|x2= <code>_map [[ctrlAddEventHandler]] ["draw", {[[hintSilent]] [[str]] [[_this]]}];</code> | |||
|seealso= [[displayAddEventHandler]], [[ctrlRemoveEventHandler]], [[ctrlRemoveAllEventHandlers]] | |||
}} | |||
[[ |
Revision as of 09:29, 5 April 2021
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
- 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
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