Class KeyboardEvent
- Namespace
- AngleSharp.Html.Dom.Events
- Assembly
- AngleSharp.dll
Represents the event arguments for a keyboard event.
[DomName("KeyboardEvent")]
public class KeyboardEvent : UiEvent
- Inheritance
-
KeyboardEvent
- Inherited Members
- Extension Methods
Constructors
KeyboardEvent()
Creates a new event.
public KeyboardEvent()
KeyboardEvent(string, bool, bool, IWindow?, int, string?, KeyboardLocation, string?, bool)
Creates a new event and initializes it.
[DomConstructor]
[DomInitDict(1, true)]
public KeyboardEvent(string type, bool bubbles = false, bool cancelable = false, IWindow? view = null, int detail = 0, string? key = null, KeyboardLocation location = KeyboardLocation.Standard, string? modifiersList = null, bool repeat = false)
Parameters
type
stringThe type of the event.
bubbles
boolIf the event is bubbling.
cancelable
boolIf the event is cancelable.
view
IWindowSets the associated view for the UI event.
detail
intSets the detail id for the UI event.
key
stringSets the key that is currently pressed.
location
KeyboardLocationSets the position of the originating keyboard.
modifiersList
stringA list with keyboard modifiers that have been pressed.
repeat
boolSets if the key has been pressed again.
Properties
IsAltPressed
Gets if the alt key is pressed.
[DomName("altKey")]
public bool IsAltPressed { get; }
Property Value
IsCtrlPressed
Gets if the control key is pressed.
[DomName("ctrlKey")]
public bool IsCtrlPressed { get; }
Property Value
IsMetaPressed
Gets if the meta key is pressed.
[DomName("metaKey")]
public bool IsMetaPressed { get; }
Property Value
IsRepeated
Gets if the key press was repeated.
[DomName("repeat")]
public bool IsRepeated { get; }
Property Value
IsShiftPressed
Gets if the shift key is pressed.
[DomName("shiftKey")]
public bool IsShiftPressed { get; }
Property Value
Key
Gets string representation of the pressed key.
[DomName("key")]
public string? Key { get; }
Property Value
Locale
Gets the locale of the keyboard.
[DomName("locale")]
public string? Locale { get; }
Property Value
Location
Gets the location of the keyboard that initiated the event.
[DomName("location")]
public KeyboardLocation Location { get; }
Property Value
Methods
GetModifierState(string)
Returns the current state of the specified modifier key.
[DomName("getModifierState")]
public bool GetModifierState(string key)
Parameters
key
stringThe modifier key to lookup.
Returns
- bool
True if the key is currently pressed, otherwise false.
Init(string, bool, bool, IWindow?, int, string, KeyboardLocation, string, bool)
Initializes the keyboard event.
[DomName("initKeyboardEvent")]
public void Init(string type, bool bubbles, bool cancelable, IWindow? view, int detail, string key, KeyboardLocation location, string modifiersList, bool repeat)
Parameters
type
stringThe type of event.
bubbles
boolDetermines if the event bubbles.
cancelable
boolDetermines if the event is cancelable.
view
IWindowSets the associated view for the UI event.
detail
intSets the detail id for the UI event.
key
stringSets the key that is currently pressed.
location
KeyboardLocationSets the position of the originating keyboard.
modifiersList
stringA list with keyboard modifiers that have been pressed.
repeat
boolSets if the key has been pressed again.