display ctrlSetEventHandler [handlerName,function]

Operand types

display: Control
[handlerName,function]: Array

Type of returned value

Description

Sets given event handler of given control.

List of possible key codes:
ESC = 1
F1 = 59
F2 = 60
F3 = 61
F4 = 62
F5 = 63
F6 = 64
F7 = 65
F8 = 66
F9 = 67
F10 = 68
F11 = 87
F12 = 88
PRINT = 183
SCROLL = 70
PAUSE = 197
^ = 41
1 = 2
2 = 3
3 = 4
4 = 5
5 = 6
6 = 7
7 = 8
8 = 9
9 = 10
0 = 11
ß = 12
´ = 13
Ü = 26
Ö = 39
Ä = 40
# = 43
< = 86
, = 51
. = 52
- = 53
+ = NOT DEFINED
POS1 = 199
TAB = 15
ENTER = 28
DELETE = 211
BACKSPACE = 14
INSERT = 210
END = 207
PAGEUP = 201
PAGEDOWN = 209
CAPS = 58
A = 30
B = 48
C = 46
D = 32
E = 18
F = 33
G = 34
H = 35
I = 23
J = 36
K = 37
L = 38
M = 50
N = 49
O = 24
P = 25
Q = 16
U = 22
R = 19
S = 31
T = 20
V = 47
W = 17
X = 45
Y = 44
Z = 21
SHIFTL = 42
SHIFTR = 54
UP = 200
DOWN = 208
LEFT = 203
RIGHT = 205
NUM_0 = 82
NUM_1 = 79
NUM_2 = 80
NUM_3 = 81
NUM_4 = 75
NUM_5 = 76
NUM_6 = 77
NUM_7 = 71
NUM_8 = 72
NUM_9 = 73
NUM_+ = 78
NUM = 69
NUM_/ = 181
NUM_* = 55
NUM_- = 74
NUM_, = 83
NUM_ENTER = 156
STRGL = 29
STRGR = 157
WINL = 220
WINR = 219
ALT = 56
SPACE = 57
ALTGR = 184
APP = 221

Used In

ArmA

Example


Example 1
---------
_control ctrlSetEventHandler ["KeyDown", ""] ...... to remove a keydown event handler

Example 2
---------
//MyKeyHandler.sqf
_control = _this select 0;
_keypressed = _this select 1;
_shift_control_alt_state = _this select 0;
_return = false;
if (_keypressed == 35) then
{
hint "H intercepted";

// Default ArmA action for H will be overriden returning true
_return = true;
};
_return
// End of MyKeyHandler.sqf

//init.sqf
MyKeyHandler = compile (preprocessFileLineNumbers "MyKeyHandler.sqf");

_control ctrlSetEventHandler ["KeyDown", "_this call MyKeyHandler"];
//End of init.sqf
Search OFPEC COMREF