displaySetEventHandler: Difference between revisions
Jump to navigation
Jump to search
m (Text replace - "{{uc:{{PAGENAME}}}}" to "{{uc:{{PAGENAME}}}} {{uc:{{PAGENAME}}}}") |
m (template:command argument fix) |
||
Line 13: | Line 13: | ||
See [[User_Interface_Event_Handlers|User Interface Event Handlers]] for the full list of handler names. | See [[User_Interface_Event_Handlers|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: [[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]]. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| display '''displaySetEventHandler''' [handlerName, function] |= | | display '''displaySetEventHandler''' [handlerName, function] |SYNTAX= | ||
|p1= display: [[Display]] |= | |p1= display: [[Display]] |PARAMETER1= | ||
|p2= [handlerName, function]: [[Array]] |= | |p2= [handlerName, function]: [[Array]] |PARAMETER2= | ||
|p3= handlerName: [[String]] |= | |p3= handlerName: [[String]] |PARAMETER3= | ||
|p4= function: [[String]]. {Code} |= | |p4= function: [[String]]. {Code} |PARAMETER4= | ||
| [[Nothing]] |= | | [[Nothing]] |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <pre>_control displaySetEventHandler ["KeyDown", ""] </pre> |= | |x1= <pre>_control displaySetEventHandler ["KeyDown", ""] </pre> |EXAMPLE1= | ||
|x2= init.sqf <pre> | |x2= init.sqf <pre> | ||
keyspressed = compile preprocessFile "keyspressed.sqf"; | keyspressed = compile preprocessFile "keyspressed.sqf"; | ||
Line 47: | Line 47: | ||
}; | }; | ||
_handled; | _handled; | ||
</pre> |= | </pre> |EXAMPLE2= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[ListOfKeyCodes]], [[displayAddEventHandler]], [[displayRemoveEventHandler]], [[displayRemoveAllEventHandlers]], [[ctrlSetEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]], [[keyName]] |= | | [[ListOfKeyCodes]], [[displayAddEventHandler]], [[displayRemoveEventHandler]], [[displayRemoveAllEventHandlers]], [[ctrlSetEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]], [[keyName]] |SEEALSO= | ||
}} | }} |
Revision as of 14:38, 7 April 2019
Description
- Description:
- Sets given event handler of given display. The return code of the provided function should indicate whether this event was handled correctly. This implies telling the engine whether it's default code should be executed. 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:
- Uncategorised
Syntax
- Syntax:
- display displaySetEventHandler [handlerName, function]
- Parameters:
- display: Display
- [handlerName, function]: Array
- handlerName: String
- function: String. {Code}
- Return Value:
- Nothing
Examples
- Example 1:
_control displaySetEventHandler ["KeyDown", ""]
- Example 2:
- init.sqf
keyspressed.sqfkeyspressed = compile preprocessFile "keyspressed.sqf"; _display = findDisplay 46; _display displaySetEventHandler ["KeyDown","_this call keyspressed"];
private['_handled']; _handled = false; switch (_this select 1) do { //F key case 33: { // code here _handled = true; }; }; _handled;
Additional Information
- See also:
- ListOfKeyCodesdisplayAddEventHandlerdisplayRemoveEventHandlerdisplayRemoveAllEventHandlersctrlSetEventHandlerUI Event HandlersDIK KeyCodeskeyName
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 Nov 25, 2009
- kju
- Always use displayAddEventHandler instead, as DSetEH overwrites other (peoples') DEH.