public override void OnKeyPress(KeyEvent evt) { base.OnKeyPress(evt); if (!IsEnabled) return; if (evt.SpecialKey == SpecialKey.Enter || evt.SpecialKey == SpecialKey.Space) { evt.Handle(this); _justKeyActivated = true; IsSelected = true; IsFocused = true; QueuePaneRender(); Click(); } }
public override void OnKeyPress(KeyEvent evt) { base.OnKeyPress(evt); evt.Handle(this); MakeDirty(); // look for special keys switch (evt.SpecialKey) { case SpecialKey.Right: CursorRight(evt.Modifier); return; case SpecialKey.Left: CursorLeft(evt.Modifier); return; case SpecialKey.Up: CursorUp(evt.Modifier); return; case SpecialKey.Down: CursorDown(evt.Modifier); return; case SpecialKey.Backspace: CursorBackspace(evt.Modifier); return; case SpecialKey.Delete: CursorDelete(evt.Modifier); return; case SpecialKey.Home: CursorHome(); return; case SpecialKey.End: CursorEnd(); return; } var charVal = (char)evt.Value; if (Char.IsLetterOrDigit(charVal) || Char.IsPunctuation(charVal) || charVal == ' ') { Insert(charVal.ToString()); } }