Hex1bKeyEvent
Namespace: Hex1b.Input
Assembly: Hex1b.dll
A keyboard input event that gets routed to the focused node.
public sealed record Hex1bKeyEvent : Hex1bEvent, IEquatable<Hex1bEvent>, IEquatable<Hex1bKeyEvent>Inheritance
Object → Hex1bEvent → Hex1bKeyEvent
Implements
Constructors
Hex1bKeyEvent(Hex1bKey, char, Hex1bModifiers)
Legacy constructor for single character input.
Parameters:
key(Hex1bKey):character(Char):modifiers(Hex1bModifiers):
public Hex1bKeyEvent(Hex1bKey key, char character, Hex1bModifiers modifiers)Hex1bKeyEvent(Hex1bKey, string, Hex1bModifiers)
A keyboard input event that gets routed to the focused node.
Parameters:
Key(Hex1bKey): The key that was pressed.Text(String): The text produced by the keypress (may be empty for non-printable keys). Supports multi-char input like emojis.Modifiers(Hex1bModifiers): The modifier keys held during the keypress.
public Hex1bKeyEvent(Hex1bKey Key, string Text, Hex1bModifiers Modifiers)Properties
Alt
Returns true if the Alt modifier is active.
Returns: Boolean
public bool Alt { get; }Character
Gets the first character of the text, or '\0' if empty. For compatibility with code expecting a single char.
Returns: Char
public char Character { get; }Control
Returns true if the Control modifier is active.
Returns: Boolean
public bool Control { get; }IsPrintable
Returns true if the key produces printable text.
Returns: Boolean
public bool IsPrintable { get; }Key
The key that was pressed.
Returns: Hex1bKey
public Hex1bKey Key { get; init; }Modifiers
The modifier keys held during the keypress.
Returns: Hex1bModifiers
public Hex1bModifiers Modifiers { get; init; }Shift
Returns true if the Shift modifier is active.
Returns: Boolean
public bool Shift { get; }Text
The text produced by the keypress (may be empty for non-printable keys). Supports multi-char input like emojis.
Returns: String
public string Text { get; init; }Methods
FromText(string)
Creates an event for text input with no modifiers (e.g., paste, emoji).
Parameters:
text(String):
Returns: Hex1bKeyEvent
public static Hex1bKeyEvent FromText(string text)Plain(Hex1bKey, char)
Creates an event for a simple key press with no modifiers.
Parameters:
Returns: Hex1bKeyEvent
public static Hex1bKeyEvent Plain(Hex1bKey key, char character = '\0')WithAlt(Hex1bKey, char)
Creates an event for a key press with Alt modifier.
Parameters:
Returns: Hex1bKeyEvent
public static Hex1bKeyEvent WithAlt(Hex1bKey key, char character = '\0')WithCtrl(Hex1bKey, char)
Creates an event for a key press with Control modifier.
Parameters:
Returns: Hex1bKeyEvent
public static Hex1bKeyEvent WithCtrl(Hex1bKey key, char character = '\0')WithShift(Hex1bKey, char)
Creates an event for a key press with Shift modifier.
Parameters:
Returns: Hex1bKeyEvent
public static Hex1bKeyEvent WithShift(Hex1bKey key, char character = '\0')