ctrlSetEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
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|Comments=
{{Command


| arma1 |Game name=
| arma1


|1.00|Game version=
|1.00


|gr1= GUI Control - Event Handlers |GROUP1=
|gr1= GUI Control - Event Handlers
|gr2= Event Handlers |GROUP2=
|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'''').}}|DESCRIPTION=
{{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] |SYNTAX=
| controlName '''ctrlSetEventHandler''' [handlerName, function]


|p1= controlName: [[Control]] |PARAMETER1=
|p1= controlName: [[Control]]


|p2= [handlerName, function]: [[Array]] |PARAMETER2=
|p2= [handlerName, function]: [[Array]]
|p3= handlerName: [[String]] |PARAMETER3=
|p3= handlerName: [[String]]
|p4= function: [[String]]|PARAMETER4=
|p4= function: [[String]]
| [[Nothing]] |RETURNVALUE=
| [[Nothing]]
   
   
|x1= <code>_control [[ctrlSetEventHandler]] ["KeyDown", ""]</code> |EXAMPLE1=
|x1= <code>_control [[ctrlSetEventHandler]] ["KeyDown", ""]</code>


|x2= <code>(_display [[displayCtrl]] 108) [[ctrlSetEventHandler]] ["LBSelChanged","['ListChange',_this] [[call]] FireEvents"];</code> |EXAMPLE2=
|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]] |SEEALSO=
| [[displaySetEventHandler]], [[ctrlAddEventHandler]], [[ctrlRemoveEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]]


}}
}}

Revision as of 00:28, 18 January 2021

Hover & click on the images for description

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.
When using the event names listed 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').
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