/// <summary> /// Raises the OnChar event. Override this method to add code to handle when a WM_CHAR message is received /// </summary> /// <param name="e">InputEventCKB for the OnChar event</param> private void invokeChar(InputEventKeyboard e) { if (KeyChar != null) { KeyChar(e); } }
/// <summary> /// Raises the KeyUp event. Override this method to add code to handle when a key is released /// </summary> /// <param name="e">KeyboardPressEventArgs for the KeyUp event</param> private void invokeKeyUp(InputEventKeyboard e) { if (KeyUp != null) { KeyUp(e); } }
/// <summary> /// Raises the KeyDown event. Override this method to add code to handle when a key is pressed /// </summary> /// <param name="e">InputEventCKB for the KeyDown event</param> private void invokeKeyDown(InputEventKeyboard e) { if (KeyDown != null) { KeyDown(e); } }
public InputEventKeyboard(KeyboardEventType eventType, InputEventKeyboard parent) : base(parent) { m_eventType = eventType; m_keyCode = parent.m_keyCode; m_keyDataExtra = parent.m_keyDataExtra; }
/// <summary> /// Reads the supplied message and executes any Keyboard events required. /// </summary> /// <param name="message">The Message to parse</param> /// <returns>A Boolean value indicating wether the Key events were handled or not</returns> private void WmKeyEvent(ref Message message) { // HandleKeyBindings(); // KeyPressEventArgs keyPressEventArgs = null; if ((message.Id == NativeConstants.WM_CHAR) || (message.Id == NativeConstants.WM_SYSCHAR)) { // Is this extra information necessary? // wm_(sys)char: http://msdn.microsoft.com/en-us/library/ms646276(VS.85).aspx InputEventKeyboard e = new InputEventKeyboard(KeyboardEventType.Press, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); IntPtr zero = (IntPtr)0;// (char)((ushort)((long)message.WParam)); invokeChar(e); } else { // wm_(sys)keydown: http://msdn.microsoft.com/en-us/library/ms912654.aspx // wm_(sys)keyup: http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx if ((message.Id == NativeConstants.WM_KEYDOWN) || (message.Id == NativeConstants.WM_SYSKEYDOWN)) { InputEventKeyboard e = new InputEventKeyboard(KeyboardEventType.Down, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); invokeKeyDown(e); } else if ((message.Id == NativeConstants.WM_KEYUP) || (message.Id == NativeConstants.WM_SYSKEYUP)) { InputEventKeyboard e = new InputEventKeyboard(KeyboardEventType.Up, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); invokeKeyUp(e); } } }
/// <summary> /// Reads the supplied message and executes any Keyboard events required. /// </summary> /// <param name="message">The Message to parse</param> /// <returns>A Boolean value indicating wether the Key events were handled or not</returns> private void WmKeyEvent(ref Message message) { // HandleKeyBindings(); // KeyPressEventArgs keyPressEventArgs = null; if ((message.Id == NativeConstants.WM_CHAR) || (message.Id == NativeConstants.WM_SYSCHAR)) { // Is this extra information necessary? // wm_(sys)char: http://msdn.microsoft.com/en-us/library/ms646276(VS.85).aspx InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Press, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); IntPtr zero = (IntPtr)0;// (char)((ushort)((long)message.WParam)); invokeChar(e); } else { // wm_(sys)keydown: http://msdn.microsoft.com/en-us/library/ms912654.aspx // wm_(sys)keyup: http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx if ((message.Id == NativeConstants.WM_KEYDOWN) || (message.Id == NativeConstants.WM_SYSKEYDOWN)) { InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Down, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); invokeKeyDown(e); } else if ((message.Id == NativeConstants.WM_KEYUP) || (message.Id == NativeConstants.WM_SYSKEYUP)) { InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Up, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); invokeKeyUp(e); } } }
/// <summary> /// Raises the KeyUp event. Override this method to add code to handle when a key is released /// </summary> /// <param name="e">KeyboardPressEventArgs for the KeyUp event</param> private void invokeKeyUp(InputEventKeyboard e) { if (KeyUp != null) KeyUp(e); }
/// <summary> /// Raises the KeyDown event. Override this method to add code to handle when a key is pressed /// </summary> /// <param name="e">InputEventCKB for the KeyDown event</param> private void invokeKeyDown(InputEventKeyboard e) { if (KeyDown != null) KeyDown(e); }
/// <summary> /// Raises the OnChar event. Override this method to add code to handle when a WM_CHAR message is received /// </summary> /// <param name="e">InputEventCKB for the OnChar event</param> private void invokeChar(InputEventKeyboard e) { if (KeyChar != null) KeyChar(e); }
protected override void OnKeyboardInput(InputEventKeyboard e) { switch (e.KeyCode) { case WinKeys.Tab: Parent.KeyboardTabToNextFocus(this); break; case WinKeys.Enter: Parent.OnKeyboardReturn(EntryID, Text); break; case WinKeys.Back: if (ReplaceDefaultTextOnFirstKeypress) { Text = string.Empty; ReplaceDefaultTextOnFirstKeypress = false; } else if (Text.Length > 0) { int escapedLength; if (EscapeCharacters.TryFindEscapeCharacterBackwards(Text, Text.Length - 1, out escapedLength)) { Text = Text.Substring(0, Text.Length - escapedLength); } else { Text = Text.Substring(0, Text.Length - 1); } } break; default: if (NumericOnly && !char.IsNumber(e.KeyChar)) return; if (ReplaceDefaultTextOnFirstKeypress) { Text = string.Empty; ReplaceDefaultTextOnFirstKeypress = false; } if (e.IsChar && e.KeyChar >= 32) { string escapedCharacter; if (EscapeCharacters.TryMatchChar(e.KeyChar, out escapedCharacter)) { Text += escapedCharacter; } else { Text += e.KeyChar; } } break; } }
public void KeyboardInput(InputEventKeyboard e) { OnKeyboardInput(e); }
protected virtual void OnKeyboardInput(InputEventKeyboard e) { }