displayAddEventHandler: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Killzone Kid (talk | contribs) (note deleted at poster request) |
||
Line 61: | Line 61: | ||
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]] | [[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]] | ||
<!-- CONTINUE Notes --> | <!-- CONTINUE Notes --> |
Revision as of 01:10, 28 May 2017
Description
- Description:
- Adds an event handler to the given display. Returns the ID of the event handler, or -1 when failed.
Returning true in EH code will override default engine handling for keyboard events.
See User Interface Event Handlers for the full list of event 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.
NOTE: Display EHs 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. - Groups:
- Uncategorised
Syntax
- Syntax:
- display displayAddEventHandler [eventName, code]
- Parameters:
- display: Display
- [eventName, code]: Array
- eventName: String
- code: String or Code
- Return Value:
- Number
Examples
- Example 1:
moduleName_keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", "hint str _this;"];
- Example 2:
moduleName_keyDownEHId = findDisplay 46 displayAddEventHandler ["KeyDown", {hint str _this}];
Additional Information
- See also:
- ListOfKeyCodesdisableSerializationdisplayRemoveAllEventHandlersdisplayRemoveEventHandlerdisplaySetEventHandlerctrlAddEventHandlerUI Event HandlersfindDisplayDIK 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 October 30, 2013 - 11:14
- Killzone_Kid
- As of Arma 3 v1.05.111658 ctrlAddEventHandler and displayAddEventHandler support script Code in addition to String [1]
- Posted on March 10, 2014 - 14:52
- Axyl
- From within an Addon, you must assign the events from a spawned script. eg
[] spawn { (findDisplay 46) displayAddEventHandler["KeyDown","_this call my_KeyDownFunctionhandler"]; };
Bottom Section
- Posted on January 22, 2016 - 08:15 (UTC)
- Pigneedle
-
Be sure to wait until the main display is initialized before using this command by using:
waituntil {!isnull (finddisplay 46)};
Categories:
- Scripting Commands
- Introduced with Arma 2 version 1.00
- Arma 2: New Scripting Commands
- Arma 2: Scripting Commands
- Command Group: Uncategorised
- ArmA 2: New Scripting Commands List
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Command Group: Interaction
- Command Group: GUI Control