Esempio n. 1
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadColorPickerEditorElement editorElement = this.EditorElement as RadColorPickerEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            this.selectionStart  = editorElement.TextBoxItem.SelectionStart;
            this.selectionLength = editorElement.TextBoxItem.SelectionLength;
            if (e.KeyCode == Keys.Return)
            {
                if (e.Modifiers != Keys.Control)
                {
                    try
                    {
                        this.Value = (object)(Color)this.converter.ConvertFromString(editorElement.Text);
                    }
                    catch (Exception ex)
                    {
                        editorElement.Focus();
                        editorElement.TextBoxItem.SelectAll();
                    }
                    this.ProcessKeyDown(e);
                    return;
                }
            }
            if (e.KeyCode != Keys.Escape)
            {
                return;
            }
            this.ProcessKeyDown(e);
            e.Handled = true;
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadColorPickerEditorElement editorElement = this.EditorElement as RadColorPickerEditorElement;
            DataFilterCriteriaElement   ownerElement  = this.OwnerElement as DataFilterCriteriaElement;

            if (editorElement == null || !editorElement.IsInValidState(true) || ownerElement == null)
            {
                return;
            }
            this.selectionStart  = editorElement.TextBoxItem.SelectionStart;
            this.selectionLength = editorElement.TextBoxItem.SelectionLength;
            if (e.KeyCode == Keys.Return && e.Modifiers != Keys.Control)
            {
                if (!this.Validate())
                {
                    return;
                }
                ownerElement.TreeViewElement.EndEdit();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                ownerElement.TreeViewElement.CancelEdit();
                e.Handled = true;
            }
            else
            {
                if (e.KeyCode != Keys.Delete || editorElement.TextBoxItem.SelectionLength != editorElement.TextBoxItem.TextLength)
                {
                    return;
                }
                editorElement.Text = string.Empty;
            }
        }
Esempio n. 3
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            RadColorPickerEditorElement editorElement = this.EditorElement as RadColorPickerEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            int length = editorElement.Text.Length;

            switch (e.KeyCode)
            {
            case Keys.Left:
                if (this.selectionLength != 0 || (this.RightToLeft || this.selectionStart != 0) && (!this.RightToLeft || this.selectionStart != length))
                {
                    break;
                }
                this.ProcessKeyDown(e);
                break;

            case Keys.Right:
                if (this.selectionLength != 0 || (this.RightToLeft || this.selectionStart != length) && (!this.RightToLeft || this.selectionStart != 0))
                {
                    break;
                }
                this.ProcessKeyDown(e);
                break;
            }
        }
        protected override void OnKeyUp(KeyEventArgs e)
        {
            RadColorPickerEditorElement editorElement = this.EditorElement as RadColorPickerEditorElement;
            DataFilterCriteriaElement   ownerElement  = this.OwnerElement as DataFilterCriteriaElement;

            if (editorElement == null || !editorElement.IsInValidState(true) || ownerElement == null)
            {
                return;
            }
            int length = editorElement.Text.Length;

            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();
                break;

            case Keys.Right:
                if ((!this.RightToLeft || this.selectionStart != 0) && (this.RightToLeft || this.selectionStart != editorElement.Text.Length))
                {
                    break;
                }
                editorElement.Validate();
                break;
            }
        }