Fandom

武装突袭 Wiki

DisplayAddEventHandler

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 分享

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

  

点击图片可看到更多讯息

开始使用于

游戏:
Arma 2
版本:
1.00

描述

描述:
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.

基本句法

句法:
display displayAddEventHandler [eventName, code]
参数:
display: Display

[eventName, code]: Array

eventName: String

code: String or Code
返回值:
Number

范例

范例1:
moduleName_keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", "hint str _this;"];

范例2:
moduleName_keyDownEHId = findDisplay 46 displayAddEventHandler ["KeyDown", {hint str _this}];

额外资讯

多人游戏:
-
也可以看看:

ListOfKeyCodesdisableSerializationdisplayRemoveAllEventHandlersdisplayRemoveEventHandlerdisplaySetEventHandlerctrlAddEventHandlerUI Event HandlersfindDisplayDIK KeyCodeskeyName

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

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 [2]
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 April 20, 2015 - 15:07 (UTC)
IT07
If you have a file in which there are variables defined that provide the key that triggers the eventHandler or variables that need to be passed onto the function called by the eventHandler if the if condition inside returns true, use this: _myCuteLittleEvent = (findDisplay 46) displayAddEventHandler ["KeyDown", " _keyDown = _this select 1; if (_keyDown == " + str (_key) + ") then { [" + str _arguments + "] call fnc_myFunction }; false; "]; where _key is a var containing the DIK keycode for the key you want to use and where _arguments is a variable that contains stuff that needs to be passed onto fnc_myFunction.


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)};

更多维基

随机维基