displayAddEventHandler: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 24: Line 24:
|p3= handlerName: [[String]] |= Parameter 3
|p3= handlerName: [[String]] |= Parameter 3


|p4= function: [[String]] |= Parameter 4
|p4= function: [[String]] or [[Code]] - script |= Parameter 4


| [[Number]] |= RETURNVALUE  
| [[Number]] |= RETURNVALUE  
Line 31: Line 31:
|x1= <code>moduleName_keyDownEHId <nowiki>=</nowiki> ([[findDisplay]] 46) [[displayAddEventHandler]] ["KeyDown", "[[hint]] [[str]] _this;"];</code> |= Example 1
|x1= <code>moduleName_keyDownEHId <nowiki>=</nowiki> ([[findDisplay]] 46) [[displayAddEventHandler]] ["KeyDown", "[[hint]] [[str]] _this;"];</code> |= Example 1


|x2= <code>moduleName_keyDownEHId <nowiki>=</nowiki> [[findDisplay]] 46 [[displayAddEventHandler]] ["KeyDown", {[[hint]] [[str]] _this}];</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 42: Line 43:
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on October 30, 2013 - 11:14
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''<dd class="note">As of Arma 3 v1.05.111658 [[ctrlAddEventHandler]] and [[displayAddEventHandler]] support script [[Code]] in addition to [[String]] [http://forums.bistudio.com/showthread.php?149636-Development-Branch-Changelog&p=2546439&viewfull=1#post2546439]
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 13:17, 30 October 2013

Hover & click on the images for description

Description

Description:
Add an event handler to the given display. Returns id of the handler or -1 when failed. 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's 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:
Uncategorised

Syntax

Syntax:
display displayAddEventHandler [handlerName, function]
Parameters:
display: Display
[handlerName, function]: Array
handlerName: String
function: String or Code - script
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]

Bottom Section