Table of Contents

Enum Key

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

The Key enumeration contains special encoding for some keys, but can also encode all the unicode values that can be passed.

[Flags]
public enum Key : uint

Fields

A = 65

The key code for the user pressing Shift-A

AltMask = 2147483648

When this value is set, the Key encodes the sequence Alt-KeyValue. And the actual value must be extracted by removing the AltMask.

B = 66

The key code for the user pressing Shift-B

BackTab = 1048586

Shift-tab key (backwards tab key).

Backspace = 8

Backspace key.

C = 67

The key code for the user pressing Shift-C

CharMask = 1048575

Mask that indicates that this is a character value, values outside this range indicate special characters like Alt-key combinations or special keys on the keyboard like function keys, arrows keys and so on.

Clear = 12

The key code for the user pressing the clear key.

CtrlMask = 1073741824

When this value is set, the Key encodes the sequence Ctrl-KeyValue. And the actual value must be extracted by removing the CtrlMask.

CursorDown = 1048577

Cursor down key.

CursorLeft = 1048578

Cursor left key.

CursorRight = 1048579

Cursor right key.

CursorUp = 1048576

Cursor up key

D = 68

The key code for the user pressing Shift-D

D0 = 48

Digit 0.

D1 = 49

Digit 1.

D2 = 50

Digit 2.

D3 = 51

Digit 3.

D4 = 52

Digit 4.

D5 = 53

Digit 5.

D6 = 54

Digit 6.

D7 = 55

Digit 7.

D8 = Backspace | D0

Digit 8.

D9 = 57

Digit 9.

Delete = 127

The key code for the user pressing the delete key.

DeleteChar = 1048585

Delete character key.

E = 69

The key code for the user pressing Shift-E

End = 1048583

End key.

Enter = 10

The key code for the user pressing the return key.

Esc = 27

The key code for the user pressing the escape key

F = 70

The key code for the user pressing Shift-F

F1 = 1048588

F1 key.

F10 = 1048597

F10 key.

F11 = 1048598

F11 key.

F12 = 1048599

F12 key.

F13 = Backspace | F5

F13 key.

F14 = 1048601

F14 key.

F15 = 1048602

F15 key.

F16 = 1048603

F16 key.

F17 = 1048604

F17 key.

F18 = 1048605

F18 key.

F19 = 1048606

F19 key.

F2 = 1048589

F2 key.

F20 = 1048607

F20 key.

F21 = Space | CursorUp

F21 key.

F22 = 1048609

F22 key.

F23 = 1048610

F23 key.

F24 = 1048611

F24 key.

F3 = 1048590

F3 key.

F4 = 1048591

F4 key.

F5 = 1048592

F5 key.

F6 = 1048593

F6 key.

F7 = 1048594

F7 key.

F8 = 1048595

F8 key.

F9 = 1048596

F9 key.

G = 71

The key code for the user pressing Shift-G

H = 72

The key code for the user pressing Shift-H

Home = 1048582

Home key.

I = 73

The key code for the user pressing Shift-I

InsertChar = Backspace | CursorUp

Insert character key.

J = 74

The key code for the user pressing Shift-J

K = 75

The key code for the user pressing Shift-K

L = 76

The key code for the user pressing Shift-L

M = 77

The key code for the user pressing Shift-M

N = 78

The key code for the user pressing Shift-N

Null = 0

The key code representing null or empty

O = 79

The key code for the user pressing Shift-O

P = 80

The key code for the user pressing Shift-P

PageDown = 1048581

Page Down key.

PageUp = 1048580

Page Up key.

PrintScreen = 1048587

Print screen character key.

Q = 81

The key code for the user pressing Shift-Q

R = 82

The key code for the user pressing Shift-R

S = 83

The key code for the user pressing Shift-S

ShiftMask = 268435456

When this value is set, the Key encodes the sequence Shift-KeyValue.

Space = 32

The key code for the user pressing the space bar

SpecialMask = 4293918720

If the SpecialMask is set, then the value is that of the special mask, otherwise, the value is the one of the lower bits (as extracted by CharMask).

T = 84

The key code for the user pressing Shift-T

Tab = 9

The key code for the user pressing the tab key (forwards tab key).

U = 85

The key code for the user pressing Shift-U

Unknown = 1048612

A key with an unknown mapping was raised.

V = 86

The key code for the user pressing Shift-V

W = 87

The key code for the user pressing Shift-W

X = Backspace | P

The key code for the user pressing Shift-X

Y = 89

The key code for the user pressing Shift-Y

Z = 90

The key code for the user pressing Shift-Z

a = Space | A

The key code for the user pressing A

b = Space | B

The key code for the user pressing B

c = 99

The key code for the user pressing C

d = Space | D

The key code for the user pressing D

e = 101

The key code for the user pressing E

f = 102

The key code for the user pressing F

g = 103

The key code for the user pressing G

h = Space | H

The key code for the user pressing H

i = 105

The key code for the user pressing I

j = 106

The key code for the user pressing J

k = 107

The key code for the user pressing K

l = 108

The key code for the user pressing L

m = 109

The key code for the user pressing M

n = 110

The key code for the user pressing N

o = 111

The key code for the user pressing O

p = Space | P

The key code for the user pressing P

q = 113

The key code for the user pressing Q

r = 114

The key code for the user pressing R

s = 115

The key code for the user pressing S

t = 116

The key code for the user pressing T

u = 117

The key code for the user pressing U

v = 118

The key code for the user pressing V

w = 119

The key code for the user pressing W

x = Backspace | p

The key code for the user pressing X

y = 121

The key code for the user pressing Y

z = 122

The key code for the user pressing Z

Remarks

If the SpecialMask is set, then the value is that of the special mask, otherwise, the value is the one of the lower bits (as extracted by CharMask)

Numerics keys are the values between 48 and 57 corresponding to 0 to 9

Upper alpha keys are the values between 65 and 90 corresponding to A to Z

Unicode runes are also stored here, the letter 'A" for example is encoded as a value 65 (not surfaced in the enum).