Search Results for

Show / Hide Table of Contents

# Class KeyEvent

Describes a keyboard event.

##### Inheritance

System.Object
KeyEvent

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class KeyEvent

### Constructors

#### KeyEvent()

Constructs a new KeyEvent

##### Declaration

    public KeyEvent()

#### KeyEvent(Key, KeyModifiers)

Constructs a new KeyEvent from the provided Key value - can be a rune cast into a Key value

##### Declaration

    public KeyEvent(Key k, KeyModifiers km)

##### Parameters

Type | Name | Description
--- | --- | ---
Key | k |
KeyModifiers | km |

### Fields

#### Key

Symb olid definition for the key.

##### Declaration

    public Key Key

##### Field Value

Type | Description
--- | ---
Key |

### Properties

#### IsAlt

Gets a value indicating whether the Alt key was pressed (real or synthesized)

##### Declaration

    public bool IsAlt { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is alternate; otherwise, `false`.

#### IsCapslock

Gets a value indicating whether the Caps lock key was pressed (real or synthesized)

##### Declaration

    public bool IsCapslock { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is alternate; otherwise, `false`.

#### IsCtrl

Determines whether the value is a control key (and NOT just the ctrl key)

##### Declaration

    public bool IsCtrl { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is ctrl; otherwise, `false`.

#### IsNumlock

Gets a value indicating whether the Num lock key was pressed (real or synthesized)

##### Declaration

    public bool IsNumlock { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is alternate; otherwise, `false`.

#### IsScrolllock

Gets a value indicating whether the Scroll lock key was pressed (real or synthesized)

##### Declaration

    public bool IsScrolllock { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is alternate; otherwise, `false`.

#### IsShift

Gets a value indicating whether the Shift key was pressed.

##### Declaration

    public bool IsShift { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if is shift; otherwise, `false`.

#### KeyValue

The key value cast to an integer, you will typical use this for extracting the Unicode rune value out of a key, when none of the symbolic options are in use.

##### Declaration

    public int KeyValue { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

### Methods

#### ToString()

Pretty prints the KeyEvent

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String |

##### Overrides

System.Object.ToString()