Skip to content
ConsoleMonster
Class

InputEvent

ConsoleMonster.Input

Namespace
ConsoleMonster.Input
Assembly
ConsoleMonster
Modifiers
sealed

One input event from any source (Windows console records, VT sequences, the PowerShell host, a script in tests), normalized so controls never care where it came from: printable characters have set, no Shift modifier, and derived from the character where one exists (letters, digits, space); Enter, Tab, Backspace and Escape carry their control character in ; Ctrl+letter has set to the letter, and no character; navigation and function keys have no character.

Inheritance

  • object
  • InputEvent

Usage

Explore 34 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 22

Methods

public static InputEvent Character(char character, KeyModifiers modifiers = None) #

Creates a typed character. Shift is dropped (the character reflects it); Alt and Control are kept.

Parameters

character char required
The character.
modifiers ConsoleMonster.Input.KeyModifiers = None optional
The modifiers.

Returns

InputEvent The event.
public static InputEvent Focus(bool gained) #

Creates a focus notification.

Parameters

gained bool required
Whether focus was gained (true) or lost.

Returns

InputEvent The event.
public bool Is(ConsoleKey key, KeyModifiers modifiers = None) #

Whether this is a press of key with exactly modifiers.

Parameters

key System.ConsoleKey required
The key.
modifiers ConsoleMonster.Input.KeyModifiers = None optional
The modifiers.

Returns

bool True on a match.
public bool IsChar(char character) #

Whether this is the typed character character (no Ctrl or Alt).

Parameters

character char required
The character.

Returns

bool True on a match.
public static InputEvent Mouse(int column, int row, int button = 1, bool pressed = true, KeyModifiers modifiers = None) #

Creates a mouse button press or release at a character-cell position, retaining all modifiers.

Parameters

column int required
The zero-based column.
row int required
The zero-based row.
button int = 1 optional
The button: 1 for left, 2 for middle, or 3 for right.
pressed bool = true optional
True for a press; false for a release.
modifiers ConsoleMonster.Input.KeyModifiers = None optional
The modifiers held when the button changed.

Returns

InputEvent The normalized mouse event.

Exceptions

  • ArgumentOutOfRangeException – A coordinate is negative or the button is not supported.
public static InputEvent Paste(string text) #

Creates a paste.

Parameters

text string required
The pasted text.

Returns

InputEvent The event.
public static InputEvent Pointer(int column, int row, MouseAction action, int button = 0, int wheelDelta = 0, int horizontalWheelDelta = 0, int heldButtons = 0, KeyModifiers modifiers = None) #

Creates a normalized pointer event. Motion/wheel events use button zero when no button changed.

Parameters

column int required
row int required
action ConsoleMonster.Input.MouseAction required
button int = 0 optional
wheelDelta int = 0 optional
horizontalWheelDelta int = 0 optional
heldButtons int = 0 optional
modifiers ConsoleMonster.Input.KeyModifiers = None optional

Returns

InputEvent