displaySetEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]2(\|.*)\]\]" to "{{GameCategory|arma2|Scripting Commands}}") |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 1: | Line 1: | ||
{{Command|Comments= | {{Command|Comments= | ||
| arma1 |Game name= | | arma1 |Game name= | ||
Line 8: | Line 7: | ||
|gr1= GUI Control - Event Handlers |GROUP1= | |gr1= GUI Control - Event Handlers |GROUP1= | ||
|gr2= Event Handlers |GROUP2= | |gr2= Event Handlers |GROUP2= | ||
| Sets given event handler of given display. | | Sets given event handler of given display. | ||
Line 19: | Line 17: | ||
<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'''').}} |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'''').}} |DESCRIPTION= | ||
| display '''displaySetEventHandler''' [handlerName, function] |SYNTAX= | | display '''displaySetEventHandler''' [handlerName, function] |SYNTAX= | ||
Line 30: | Line 27: | ||
| [[Nothing]] |RETURNVALUE= | | [[Nothing]] |RETURNVALUE= | ||
|x1= <pre>_control displaySetEventHandler ["KeyDown", ""] </pre> |EXAMPLE1= | |x1= <pre>_control displaySetEventHandler ["KeyDown", ""] </pre> |EXAMPLE1= | ||
Line 53: | Line 49: | ||
_handled; | _handled; | ||
</pre> |EXAMPLE2= | </pre> |EXAMPLE2= | ||
| [[ListOfKeyCodes]], [[displayAddEventHandler]], [[displayRemoveEventHandler]], [[displayRemoveAllEventHandlers]], [[ctrlSetEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]], [[keyName]] |SEEALSO= | | [[ListOfKeyCodes]], [[displayAddEventHandler]], [[displayRemoveEventHandler]], [[displayRemoveAllEventHandlers]], [[ctrlSetEventHandler]], [[User_Interface_Event_Handlers|UI Event Handlers]], [[DIK_KeyCodes|DIK KeyCodes]], [[keyName]] |SEEALSO= |
Revision as of 00:40, 17 January 2021
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 is 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:
- GUI Control - Event HandlersEvent Handlers
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.
Bottom Section
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