Class KeyboardEventDispatchExtensions
- Namespace
- Bunit
- Assembly
- Bunit.Web.dll
Keyboard event dispatch helper extension methods.
public static class KeyboardEventDispatchExtensions
- Inheritance
-
KeyboardEventDispatchExtensions
- Inherited Members
Methods
KeyDown(IElement, Key, bool, string?)
Raises the @onkeydown event on element, passing the provided key
to the event handler.
public static void KeyDown(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keyKeyThe keyboard key to pass to the event handler.
repeatbooltrueif a key has been depressed long enough to trigger key repetition, otherwisefalse.typestringThe type of the event.
KeyDown(IElement, KeyboardEventArgs)
Raises the @onkeydown event on element, passing the provided eventArgs
to the event handler.
public static void KeyDown(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
KeyDown(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeydown event on element, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyDown(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keystringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
codestringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
locationfloatThe location of the key on the device.
repeatbooltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKeybooltrue if the control key was down when the event was fired. false otherwise.
shiftKeybooltrue if the shift key was down when the event was fired. false otherwise.
altKeybooltrue if the alt key was down when the event was fired. false otherwise.
metaKeybooltrue if the meta key was down when the event was fired. false otherwise.
typestringThe type of the event.
KeyDownAsync(IElement, KeyboardEventArgs)
Raises the @onkeydown event on element, passing the provided eventArgs
to the event handler.
public static Task KeyDownAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.
KeyPress(IElement, Key, bool, string?)
Raises the @onkeypress event on element, passing the provided key
to the event handler.
public static void KeyPress(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keyKeyThe keyboard key to pass to the event handler.
repeatbooltrueif a key has been depressed long enough to trigger key repetition, otherwisefalse.typestringThe type of the event.
KeyPress(IElement, KeyboardEventArgs)
Raises the @onkeypress event on element, passing the provided eventArgs
to the event handler.
public static void KeyPress(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
KeyPress(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeypress event on element, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyPress(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keystringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
codestringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
locationfloatThe location of the key on the device.
repeatbooltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKeybooltrue if the control key was down when the event was fired. false otherwise.
shiftKeybooltrue if the shift key was down when the event was fired. false otherwise.
altKeybooltrue if the alt key was down when the event was fired. false otherwise.
metaKeybooltrue if the meta key was down when the event was fired. false otherwise.
typestringThe type of the event.
KeyPressAsync(IElement, KeyboardEventArgs)
Raises the @onkeypress event on element, passing the provided eventArgs
to the event handler.
public static Task KeyPressAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.
KeyUp(IElement, Key, bool, string?)
Raises the @onkeyup event on element, passing the provided key
to the event handler.
public static void KeyUp(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keyKeyThe keyboard key to pass to the event handler.
repeatbooltrueif a key has been depressed long enough to trigger key repetition, otherwisefalse.typestringThe type of the event.
KeyUp(IElement, KeyboardEventArgs)
Raises the @onkeyup event on element, passing the provided eventArgs
to the event handler.
public static void KeyUp(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
KeyUp(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeyup event on element, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyUp(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
elementIElementThe element to raise the event on.
keystringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
codestringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
locationfloatThe location of the key on the device.
repeatbooltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKeybooltrue if the control key was down when the event was fired. false otherwise.
shiftKeybooltrue if the shift key was down when the event was fired. false otherwise.
altKeybooltrue if the alt key was down when the event was fired. false otherwise.
metaKeybooltrue if the meta key was down when the event was fired. false otherwise.
typestringThe type of the event.
KeyUpAsync(IElement, KeyboardEventArgs)
Raises the @onkeyup event on element, passing the provided eventArgs
to the event handler.
public static Task KeyUpAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
elementIElementThe element to raise the event on.
eventArgsKeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.