public override void BeginEdit() { base.BeginEdit(); RadTextBoxControlElement textBox = this.TextBox; RadControl radControl = this.EditorElement.ElementTree == null || this.EditorElement.ElementTree.Control == null ? (RadControl)null : this.EditorElement.ElementTree.Control as RadControl; if (radControl != null && TelerikHelper.IsMaterialTheme(radControl.ThemeName)) { textBox.StretchVertically = true; if (this.EditorElement.Parent != null) { this.EditorElement.Parent.UpdateLayout(); } } else { textBox.StretchVertically = this.TextBox.Multiline; } textBox.SelectAll(); textBox.Focus(); textBox.TextChanging += new TextChangingEventHandler(this.OnTextChanging); textBox.TextChanged += new EventHandler(this.OnTextChanged); textBox.MouseWheel += new MouseEventHandler(this.OnElementMouseWheel); textBox.KeyDown += new KeyEventHandler(this.OnElementKeyDown); textBox.KeyUp += new KeyEventHandler(this.OnElementKeyUp); textBox.Navigator.SelectionChanging += new SelectionChangingEventHandler(this.Navigator_SelectionChanging); }
protected virtual void OnKeyUp(KeyEventArgs e) { RadTextBoxControlElement textBox = this.TextBox; if (textBox == null || !textBox.IsInValidState(true) || textBox.IsAutoCompleteDropDownOpen) { return; } int textLength = textBox.TextLength; int selectionStart = textBox.SelectionStart; int selectionLength = textBox.SelectionLength; switch (e.KeyCode) { case Keys.Left: if (selectionLength != 0 || (this.RightToLeft || selectionStart != 0) && (!this.RightToLeft || selectionStart != textLength)) { break; } base.OnKeyDown(e); break; case Keys.Right: if (selectionLength != 0 || (this.RightToLeft || selectionStart != textLength) && (!this.RightToLeft || selectionStart != 0)) { break; } base.OnKeyDown(e); break; } }
protected override void CreateChildElements() { base.CreateChildElements(); textBoxElement = new RadTextBoxControlElement(); textBoxElement.ContextMenuOpening += textBoxElement_ContextMenuOpening; this.Children.Add(textBoxElement); }
protected override void CreateChildItems(RadElement parent) { base.CreateChildItems(parent); this.textBoxElement = this.CreateTextBoxElement(); this.textBoxElement.TextChanged += new EventHandler(this.OnTextBoxElementTextChanged); this.textBoxElement.TextChanging += new TextChangingEventHandler(this.OnTextBoxElementTextChanging); this.RootElement.Children.Add((RadElement)this.textBoxElement); }
public TextBoxInputHandler(RadTextBoxControlElement textBoxElement) { this.textBoxElement = textBoxElement; this.scrollTimer = new Timer(); this.scrollTimer.Enabled = false; this.scrollTimer.Interval = 20; this.scrollTimer.Tick += new EventHandler(this.OnScrollTimerTick); }
public RadTextBoxAutoCompleteDropDown(RadTextBoxControlElement owner) : base((RadItem)owner) { this.SizingGripDockLayout.Children.Add((RadElement)this.TextBox.ListElement); this.SizingGrip.ShouldAspectRootElement = false; this.SizingMode = SizingMode.UpDownAndRightBottom; this.TabStop = false; }
public TextBoxControlDefaultContextMenu(RadTextBoxControlElement textBox) { this.textBox = textBox; this.cutMenuItem = this.AddMenuItem("ContextMenuCut"); this.copyMenuItem = this.AddMenuItem("ContextMenuCopy"); this.pasteMenuItem = this.AddMenuItem("ContextMenuPaste"); this.deleteMenuItem = this.AddMenuItem("ContextMenuDelete"); this.Items.Add((RadItem) new RadMenuSeparatorItem()); this.selectAllMenuItem = this.AddMenuItem("ContextMenuSelectAll"); }
public static bool SetCompositionWindow( IntPtr hIMC, RadTextBoxControlElement caretTextBox, Point point) { ImeHelper.SetCompositionFont(caretTextBox, hIMC); return(IMENativeWrapper.ImmSetCompositionWindow(hIMC, ref new IMENativeWrapper.CompositionForm() { dwStyle = 32, ptCurrentPos = { x = Math.Max(0, point.X), y = Math.Max(0, point.Y) } })); }
public TextBoxNavigator(RadTextBoxControlElement textBoxElement) { this.textBoxElement = textBoxElement; this.selectionStart = (TextPosition)null; this.selectionEnd = (TextPosition)null; TextBoxViewElement viewElement = this.textBoxElement.ViewElement; viewElement.VScroller.ScrollerUpdated += new EventHandler(this.OnScrollerUpdated); viewElement.HScroller.ScrollerUpdated += new EventHandler(this.OnScrollerUpdated); viewElement.TextChanged += new EventHandler(this.OnViewElementTextChanged); this.textBoxElement.RadPropertyChanged += new RadPropertyChangedEventHandler(this.OnTextBoxElementRadPropertyChanged); }
public override bool EndEdit() { RadTextBoxControlElement textBox = this.TextBox; textBox.TextChanging -= new TextChangingEventHandler(this.OnTextBoxTextChanging); textBox.TextChanged -= new EventHandler(this.OnTextBoxTextChanged); textBox.KeyDown -= new KeyEventHandler(this.OnTextBoxKeyDown); textBox.RadPropertyChanged -= new RadPropertyChangedEventHandler(this.OnTextBoxRadPropertyChanged); textBox.Text = string.Empty; textBox.Select(0, 0); return(base.EndEdit()); }
public override void BeginEdit() { base.BeginEdit(); RadTextBoxControlElement textBox = this.TextBox; textBox.SelectAll(); textBox.Focus(); textBox.TextChanging += new TextChangingEventHandler(this.OnTextBoxTextChanging); textBox.TextChanged += new EventHandler(this.OnTextBoxTextChanged); textBox.KeyDown += new KeyEventHandler(this.OnTextBoxKeyDown); textBox.RadPropertyChanged += new RadPropertyChangedEventHandler(this.OnTextBoxRadPropertyChanged); }
protected virtual void SetScrollBarVisibility() { RadTextBoxControlElement parent = this.scrollBar.Parent as RadTextBoxControlElement; if ((parent == null || parent.ViewElement.Multiline) && (this.scrollState == ScrollState.AlwaysShow || this.scrollState == ScrollState.AutoHide && this.scrollBar.LargeChange < this.scrollBar.Maximum)) { this.scrollBar.Visibility = ElementVisibility.Visible; } else { this.scrollBar.Visibility = ElementVisibility.Collapsed; } }
public override void OnKeyDown(KeyEventArgs e) { RadTextBoxControlElement textBox = this.TextBox; if (textBox == null || !textBox.IsInValidState(true) || textBox.IsAutoCompleteDropDownOpen) { return; } int selectionStart = textBox.SelectionStart; int selectionLength = textBox.SelectionLength; bool flag1 = false; bool flag2 = false; TextPosition caretPosition = textBox.Navigator.CaretPosition; if (caretPosition != (TextPosition)null) { LineInfoCollection lines = textBox.ViewElement.Lines; flag1 = lines.FirstLine == caretPosition.Line; flag2 = lines.LastLine == caretPosition.Line; } switch (e.KeyCode) { case Keys.Return: if (e.Modifiers == Keys.Control) { break; } base.OnKeyDown(e); break; case Keys.Up: if (this.Multiline && (selectionLength != 0 || !flag1)) { break; } base.OnKeyDown(e); break; case Keys.Down: if (this.Multiline && (selectionLength != 0 || !flag2)) { break; } base.OnKeyDown(e); break; } }
public override bool EndEdit() { RadTextBoxControlElement textBox = this.TextBox; textBox.TextChanging -= new TextChangingEventHandler(this.OnTextChanging); textBox.TextChanged -= new EventHandler(this.OnTextChanged); textBox.MouseWheel -= new MouseEventHandler(this.OnElementMouseWheel); textBox.KeyDown -= new KeyEventHandler(this.OnElementKeyDown); textBox.KeyUp -= new KeyEventHandler(this.OnElementKeyUp); textBox.Text = string.Empty; textBox.Select(0, 0); textBox.ListElement.StartPosition = (TextPosition)null; textBox.ListElement.EndPosition = (TextPosition)null; textBox.AutoCompleteDataSource = (object)null; textBox.AutoCompleteItems.Clear(); return(base.EndEdit()); }
private static void SetCompositionFont(RadTextBoxControlElement caretTextBox, IntPtr hIMC) { double height = (double)caretTextBox.Font.Height; IMENativeWrapper.LOGFONT logfont = new IMENativeWrapper.LOGFONT() { lfHeight = (int)height, lfFaceName = caretTextBox.Font.FontFamily.Name }; IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf((object)logfont)); try { Marshal.StructureToPtr((object)logfont, num, true); IMENativeWrapper.ImmSetCompositionFontW(hIMC, num); } finally { Marshal.FreeHGlobal(num); } }
protected override void OnLoaded() { base.OnLoaded(); if (this.Children.Contains(this.TextBoxItem)) { this.Children.Remove(this.TextBoxItem); } TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; if (nodeElement.NodeElement.Data != null) { DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; mainContainer.MinSize = new Size(columnWidth * row.Table.Columns.Count, nodeElement.NodeElement.Data.TreeView.ItemHeight); mainContainer.DrawFill = true; mainContainer.GradientStyle = GradientStyles.Solid; mainContainer.BackColor = nodeElement.NodeElement.BackColor; mainContainer.Margin = new Padding(-2, -4, 0, 0); if (headersContainer.Children.Count == 0) { foreach (DataColumn col in row.Table.Columns) { //generate columns LightVisualElement columnHeader = new LightVisualElement(); columnHeader.MinSize = new System.Drawing.Size(columnWidth, 20); columnHeader.StretchHorizontally = true; columnHeader.Text = col.ColumnName; headersContainer.Children.Add(columnHeader); StyleBorder(columnHeader); //generate data cells if (col.ColumnName == "DeliveryType") { this.dropDownList = new RadDropDownListElement(); this.dropDownList.DropDownStyle = RadDropDownStyle.DropDownList; this.dropDownList.MinSize = new System.Drawing.Size(columnWidth, 0); nodeContentContainer.Children.Add(this.dropDownList); this.dropDownList.DataSource = Enum.GetValues(typeof(DeliveryType)); this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } else if (col.ColumnName == "Date") { this.dateEditor = new RadDateTimeEditorElement(); this.dateEditor.Format = DateTimePickerFormat.Custom; this.dateEditor.CustomFormat = "dd/MM/yyyy"; this.dateEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.dateEditor); this.dateEditor.ValueChanged += DateEditor_ValueChanged; } else if (col.ColumnName == "Id") { this.idEditor = new LightVisualElement(); this.idEditor.StretchVertically = true; this.idEditor.MinSize = new System.Drawing.Size(columnWidth, 24); StyleBorder(this.idEditor); nodeContentContainer.Children.Add(this.idEditor); } else if (col.ColumnName == "ParentId") { this.parentIdEditor = new LightVisualElement(); this.parentIdEditor.MinSize = new System.Drawing.Size(columnWidth, 20); this.parentIdEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.parentIdEditor); nodeContentContainer.Children.Add(this.parentIdEditor); } else if (col.ColumnName == "Title") { this.titleEditor = new RadTextBoxControlElement(); this.titleEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.titleEditor); this.titleEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.titleEditor); this.titleEditor.TextChanged += TitleEditor_TextChanged; } } } this.dropDownList.SelectedValueChanged -= DropDownList_SelectedValueChanged; this.dateEditor.ValueChanged -= DateEditor_ValueChanged; this.titleEditor.TextChanged -= TitleEditor_TextChanged; this.idEditor.Text = row["Id"].ToString(); this.parentIdEditor.Text = row["ParentId"].ToString(); this.titleEditor.Text = row["Title"].ToString(); this.dateEditor.Value = (DateTime)row["Date"]; this.dropDownList.SelectedValue = row["DeliveryType"]; this.titleEditor.TextChanged += TitleEditor_TextChanged; this.dateEditor.ValueChanged += DateEditor_ValueChanged; this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } }
public ImeSupport(RadTextBoxControlElement textBox) { this.textBoxControl = textBox; this.imeDefaultWnd = IntPtr.Zero; this.WireEvents(); }
public TextBoxSelectionPrimitive(RadTextBoxControlElement textBox) { this.textBoxElement = textBox; }