displaySetEventHandler

From Bohemia Interactive Community
Revision as of 04:21, 25 August 2008 by Dr Eyeball (talk | contribs) (UI EH, DIK_KeyCodes & function handled return value, fix example with _handled)
Jump to navigation Jump to search
-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Sets given event handler of given display. 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 displaySetEventHandler ["HandlerName", "function"]
Parameters:
display Display
HandlerName: String
function String. {Code}
Return Value:
Nothing

Examples

Example 1:
_control displaySetEventHandler ["KeyDown", ""] 
Example 2:
init.sqf

keyspressed = compile preprocessFile "keyspressed.sqf"; _display = findDisplay 46; _display displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressed.sqf
private['_handled'];
_handled = false;
switch (_this select 1) do
{
	//F key
	case 33: 
	{
		// code here
		_handled = true;
	};
};
_handled;

Additional Information

See also:
ctrlSetEventHandlerUI 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

Here is a list of key codes, which I found out with a German keyboard (SAITEK):
  • 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
--T_D 13:37, 8 December 2006 (CET)

Bottom Section