ctrlSetEventHandler: 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 | ||
| arma1 | | arma1 | ||
|1.00 | |1.00 | ||
|gr1= GUI Control - Event Handlers | |gr1= GUI Control - Event Handlers | ||
|gr2= Event Handlers | |gr2= Event Handlers | ||
| Sets given event handler of given control. | | Sets given event handler of given control. | ||
Line 15: | Line 15: | ||
If applicable, see [[DIK_KeyCodes]] for a list of key code constants, which are relevant to key related user interface events like: [[User_Interface_Event_Handlers#onKeyDown|KeyDown]] & [[User_Interface_Event_Handlers#onKeyUp|KeyUp]]. | If applicable, see [[DIK_KeyCodes]] for a list of key code constants, which are relevant to key related user interface events like: [[User_Interface_Event_Handlers#onKeyDown|KeyDown]] & [[User_Interface_Event_Handlers#onKeyUp|KeyUp]]. | ||
{{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'''').}} | ||
| controlName '''ctrlSetEventHandler''' [handlerName, function] | | controlName '''ctrlSetEventHandler''' [handlerName, function] | ||
|p1= controlName: [[Control]] | |p1= controlName: [[Control]] | ||
|p2= [handlerName, function]: [[Array]] | |p2= [handlerName, function]: [[Array]] | ||
|p3= handlerName: [[String]] | |p3= handlerName: [[String]] | ||
|p4= function: [[String]] | |p4= function: [[String]] | ||
| [[Nothing]] | | [[Nothing]] | ||
|x1= <code>_control [[ctrlSetEventHandler]] ["KeyDown", ""]</code> | |x1= <code>_control [[ctrlSetEventHandler]] ["KeyDown", ""]</code> | ||
|x2= <code>(_display [[displayCtrl]] 108) [[ctrlSetEventHandler]] ["LBSelChanged","['ListChange',_this] [[call]] FireEvents"];</code> | |x2= <code>(_display [[displayCtrl]] 108) [[ctrlSetEventHandler]] ["LBSelChanged","['ListChange',_this] [[call]] FireEvents"];</code> | ||
| [[displaySetEventHandler]], [[ctrlAddEventHandler]], [[ctrlRemoveEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]] | | [[displaySetEventHandler]], [[ctrlAddEventHandler]], [[ctrlRemoveEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]] | ||
}} | }} |
Revision as of 00:28, 18 January 2021
Description
- Description:
- Sets given event handler of given control. The provided function should return true/false indicating that the event has handled this event fully or not and whether the engine should execute it is default code or not afterwards. See User Interface Event Handlers for the full list of handler names. If applicable, see DIK_KeyCodes for a list of key code constants, which are relevant to key related user interface events like: KeyDown & KeyUp.
- Groups:
- GUI Control - Event HandlersEvent Handlers
Syntax
- Syntax:
- controlName ctrlSetEventHandler [handlerName, function]
- Parameters:
- controlName: Control
- [handlerName, function]: Array
- handlerName: String
- function: String
- Return Value:
- Nothing
Examples
- Example 1:
_control ctrlSetEventHandler ["KeyDown", ""]
- Example 2:
(_display displayCtrl 108) ctrlSetEventHandler ["LBSelChanged","['ListChange',_this] call FireEvents"];
Additional Information
- See also:
- displaySetEventHandlerctrlAddEventHandlerctrlRemoveEventHandlerUI Event HandlersDIK KeyCodes
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
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Command Group: GUI Control - Event Handlers
- Command Group: Event Handlers
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands