Exemplo n.º 1
0
        protected virtual void OnKeyUp(KeyEventArgs e)
        {
            RadSpinEditorElement editorElement = this.EditorElement as RadSpinEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            switch (e.KeyCode)
            {
            case Keys.Left:
                if ((!this.RightToLeft || this.selectionStart != editorElement.Text.Length) && (this.RightToLeft || this.selectionStart != 0 || this.selectionLength != 0))
                {
                    break;
                }
                editorElement.Validate();
                base.OnKeyDown(e);
                break;

            case Keys.Right:
                if ((!this.RightToLeft || this.selectionStart != 0) && (this.RightToLeft || this.selectionStart != editorElement.Text.Length))
                {
                    break;
                }
                editorElement.Validate();
                base.OnKeyDown(e);
                break;
            }
        }
Exemplo n.º 2
0
        public override void OnKeyDown(KeyEventArgs e)
        {
            RadSpinEditorElement editorElement = this.EditorElement as RadSpinEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            this.selectionStart  = editorElement.TextBoxItem.SelectionStart;
            this.selectionLength = editorElement.TextBoxItem.SelectionLength;
            switch (e.KeyCode)
            {
            case Keys.Return:
                if (e.Modifiers == Keys.Control)
                {
                    break;
                }
                editorElement.Validate();
                base.OnKeyDown(e);
                break;

            case Keys.Delete:
                if (this.selectionLength != editorElement.TextBoxItem.TextLength)
                {
                    break;
                }
                editorElement.Text = (string)null;
                break;
            }
        }