public ComboBoxElement(ElementHostControl host,InternalTextBox textBox) : base(host) { m_InternalTextBox = textBox; m_Button = new ComboButtonElement(host); m_Button.ZOrder = 2; m_Button.MouseClick += delegate(object sender, MouseEventArgs e) { OnButtonClick(EventArgs.Empty); }; }
}//makeTextBox private void destroyDataEntryElement() { if (m_DataEntryElement != null) { m_DataEntryElement.Dispose(); m_DataEntryElement = null; } if (m_InternalTextBox != null) { m_InternalTextBox.Dispose(); m_InternalTextBox = null; } }
private void makeTextBox() { m_InternalTextBox = new InternalTextBox(); m_InternalTextBox.Parent = this; m_InternalTextBox.Visible = false; m_InternalTextBox.Multiline = true; //otherwise id does not paint m_InternalTextBox.WordWrap = false; m_InternalTextBox.TabStop = false; setTextBoxHAlignment(m_TextHAlignment); if (Field != null) { applyReadonly(); if (Field is StringField) { int size = ((StringField)Field).Size; if (size > 0) { m_InternalTextBox.MaxLength = size; } if (((StringField)Field).Password) { m_InternalTextBox.PasswordChar = '*'; m_InternalTextBox.Multiline = false; //otherwise "*" dont show } } } m_InternalTextBox.Validating += delegate(object sender, CancelEventArgs e) { if (Field != null) { if (Field.Validated && Field.KeepInErroredField && !(Field.ValidationException is RequiredValidationException)) { e.Cancel = !Field.Valid; checkAndShowErrorBalloon(); } } }; m_InternalTextBox.KeyDown += delegate(object sender, KeyEventArgs e) { if ( (e.KeyCode == Keys.Return) && (m_LineCount == 1 || (m_LineCount > 1 && e.Control)) ) //emulate single-line textbox { e.Handled = true; e.SuppressKeyPress = true; if ((m_ActualControlType == ControlType.Combo)) { if ( ( (!HasValue) && (m_InternalTextBox.Text.Trim() == string.Empty) ) || (e.Shift) ) { if (!Lookup()) { return; } } } focusNextSibling(); } else if (e.KeyCode == Keys.Back && e.Control && !IsReadonly) { e.Handled = true; e.SuppressKeyPress = true; m_InternalTextBox.Modified = false; ClearValue(); } else if (e.KeyCode == Keys.Escape) { m_InternalTextBox.Undo(); } }; }//makeTextBox
public TextBoxElement(ElementHostControl host,InternalTextBox textBox) : base(host) { m_InternalTextBox = textBox; }