protected override RadElement CreateEditorElement() { RadMaskedEditBoxEditorElement boxEditorElement = new RadMaskedEditBoxEditorElement(); boxEditorElement.TextBoxItem.RouteMessages = false; return((RadElement)boxEditorElement); }
public override void OnKeyDown(KeyEventArgs e) { RadMaskedEditBoxEditorElement editorElement = this.EditorElement as RadMaskedEditBoxEditorElement; if (editorElement == null || !editorElement.IsInValidState(true)) { return; } switch (e.KeyCode) { case Keys.Return: if (e.Modifiers == Keys.Control) { break; } base.OnKeyDown(e); break; case Keys.Escape: case Keys.Up: case Keys.Down: base.OnKeyDown(e); break; } }
public override void BeginEdit() { base.BeginEdit(); RadMaskedEditBoxEditorElement editorElement = this.EditorElement as RadMaskedEditBoxEditorElement; string str = this.MaskTextBox.Value != null?this.MaskTextBox.Value.ToString() : this.MaskTextBox.Text; if (editorElement.MaskType != MaskType.Regex) { str = str.Replace(" ", ""); } this.oldValue = str; if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement)) { editorElement.BackColor = Color.White; } editorElement.TextBoxItem.SelectAll(); editorElement.TextChanging += new TextChangingEventHandler(this.Editor_TextChanging); editorElement.ValueChanged += new EventHandler(this.Editor_TextChanged); this.MaskTextBox.KeyDown += new KeyEventHandler(this.MaskTextBox_KeyDown); this.MaskTextBox.KeyUp += new KeyEventHandler(this.MaskTextBox_KeyUp); this.MaskTextBox.MouseWheel += new MouseEventHandler(this.Editor_MouseWheel); this.MaskTextBox.TextBoxItem.HostedControl.Focus(); this.originalValue = (object)str; this.selectionStart = -1; this.selectionLength = -1; }
public override bool EndEdit() { base.EndEdit(); RadMaskedEditBoxEditorElement editorElement = this.EditorElement as RadMaskedEditBoxEditorElement; editorElement.TextChanging -= new TextChangingEventHandler(this.Editor_TextChanging); editorElement.ValueChanged -= new EventHandler(this.Editor_TextChanged); this.MaskTextBox.KeyDown -= new KeyEventHandler(this.MaskTextBox_KeyDown); this.MaskTextBox.KeyUp -= new KeyEventHandler(this.MaskTextBox_KeyUp); this.MaskTextBox.MouseWheel -= new MouseEventHandler(this.Editor_MouseWheel); editorElement.Text = string.Empty; this.oldValue = (string)null; return(true); }
private void ValidateRowIndicator(RadMaskedEditBoxEditorElement editor) { RadGridViewElement ancestor = this.MaskTextBox.FindAncestor <RadGridViewElement>(); if (ancestor == null) { return; } if (!((RegexMaskTextBoxProvider)editor.Provider).IsValid) { ancestor.CurrentRow.ErrorText = "Value is not valid"; } else { ancestor.CurrentRow.ErrorText = string.Empty; } }
protected virtual void OnKeyUp(KeyEventArgs e) { RadMaskedEditBoxEditorElement editorElement1 = this.EditorElement as RadMaskedEditBoxEditorElement; if (editorElement1 == null || !editorElement1.IsInValidState(true)) { return; } RadMaskedEditBoxEditorElement editorElement2 = this.EditorElement as RadMaskedEditBoxEditorElement; if (e.KeyCode != Keys.Left && e.KeyCode != Keys.Right) { return; } if (this.selectionStart == editorElement2.TextBoxItem.SelectionStart && this.selectionLength == editorElement2.TextBoxItem.SelectionLength) { base.OnKeyDown(e); } this.selectionStart = editorElement2.TextBoxItem.SelectionStart; this.selectionLength = editorElement2.TextBoxItem.SelectionLength; }