Exemple #1
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            // m_sda COM object block removed due to crash in Finializer thread LT-6124

            if (disposing)
            {
                if (m_button != null)
                {
                    m_button.MouseDown -= new MouseEventHandler(m_button_MouseDown);
                    m_button.GotFocus  -= new EventHandler(m_button_GotFocus);
                    m_button.LostFocus -= new EventHandler(m_button_LostFocus);
                }

                if (m_sda != null)
                {
                    m_sda.RemoveNotification(this);
                }

                if (m_comboTextBox != null)
                {
                    m_comboTextBox.KeyPress  -= new KeyPressEventHandler(m_comboTextBox_KeyPress);
                    m_comboTextBox.KeyDown   -= new KeyEventHandler(m_comboTextBox_KeyDown);
                    m_comboTextBox.MouseDown -= new MouseEventHandler(m_comboTextBox_MouseDown);
                    m_comboTextBox.GotFocus  -= new EventHandler(m_comboTextBox_GotFocus);
                    m_comboTextBox.LostFocus -= new EventHandler(m_comboTextBox_LostFocus);
                }
                if (m_popupTree != null)
                {
                    m_popupTree.AfterSelect    -= new TreeViewEventHandler(m_tree_AfterSelect);
                    m_popupTree.BeforeSelect   -= new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
                    m_popupTree.Load           -= new EventHandler(m_tree_Load);
                    m_popupTree.VisibleChanged -= new EventHandler(m_popupTree_VisibleChanged);
                }

                if (m_popupTree != null && !m_popupTree.IsDisposed)
                {
                    m_popupTree.Dispose();
                }
            }
            m_button       = null;       // So OnLayout knows to do nothing.
            m_comboTextBox = null;
            m_popupTree    = null;
            m_sda          = null;

            base.Dispose(disposing);
        }
        /// <summary>
        /// Initializes a new instance of <see cref="EditableComboBoxDisplay"/> class.
        /// </summary>
        public EditableComboBoxDisplay(TypedTextParser textParser)
            : base()
        {
            textBox                     = new ComboTextBox();
            textBox.BorderStyle         = BorderStyle.None;
            textBox.TabStop             = false;
            textBox.Enter              += new EventHandler(textBox_Enter);
            textBox.EnterPressed       += new EventHandler(textBox_EnterPressed);
            textBox.EscapePressed      += new EventHandler(textBox_EscapePressed);
            textBox.AltDownOrF4Pressed += new EventHandler(textBox_AltDownOrF4Pressed);
            textBox.Validated          += new EventHandler(textBox_Validated);
            textBox.Name                = "textBox";

            this.ParseTypedText = textParser;
            this.Controls.Add(textBox);
        }
Exemple #3
0
		protected override void Dispose (bool disposing)
		{
			if (disposing) {
				if (listbox_ctrl != null) {
					listbox_ctrl.Dispose ();
					Controls.RemoveImplicit (listbox_ctrl);
					listbox_ctrl = null;
				}
			
				if (textbox_ctrl != null) {
					Controls.RemoveImplicit (textbox_ctrl);
					textbox_ctrl.Dispose ();
					textbox_ctrl = null;
				}
			}
			
			base.Dispose (disposing);
		}
Exemple #4
0
        /// <summary>
        /// Construct one.
        /// </summary>
        public TreeCombo()
        {
            this.SuspendLayout();
            // Set this box's own properties (first, as we use some of them in figuring the
            // size of other things).

            // Make and install the ComboTextBox
            m_comboTextBox = new ComboTextBox(this);
            m_comboTextBox.AccessibleName = "TextBox";
            m_comboTextBox.Dock           = DockStyle.Fill;
            m_comboTextBox.Visible        = true;
            // Don't allow typing or pasting into the text box: see LT-6595.
            m_comboTextBox.ReadOnlyView = true;

            // These two lines causes us to get a notification when the string gets changed,
            // so we can fire our TextChanged event.
            m_sda = m_comboTextBox.DataAccess;
            m_sda.AddNotification(this);

            m_comboTextBox.MouseDown += new MouseEventHandler(m_comboTextBox_MouseDown);
            m_comboTextBox.KeyPress  += new KeyPressEventHandler(m_comboTextBox_KeyPress);
            m_comboTextBox.KeyDown   += new KeyEventHandler(m_comboTextBox_KeyDown);
            m_comboTextBox.GotFocus  += new EventHandler(m_comboTextBox_GotFocus);
            m_comboTextBox.LostFocus += new EventHandler(m_comboTextBox_LostFocus);

            m_textBoxPanel = new Panel();
            m_textBoxPanel.AccessibleName = "TextBoxPanel";
            m_textBoxPanel.Dock           = DockStyle.Fill;
            m_textBoxPanel.BackColor      = Color.Transparent;
            m_textBoxPanel.Controls.Add(m_comboTextBox);
            this.Controls.Add(m_textBoxPanel);

            // Make and install the button that pops up the list.
            m_button = new DropDownButton(this);
            m_button.AccessibleName = "DropDownButton";
            m_button.Dock           = DockStyle.Right;   // Enhance JohnT: Left if RTL language?

            //m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
            m_button.MouseDown += new MouseEventHandler(m_button_MouseDown);
            m_button.GotFocus  += new EventHandler(m_button_GotFocus);
            m_button.LostFocus += new EventHandler(m_button_LostFocus);
            m_button.TabStop    = false;

            m_buttonPanel = new Panel();
            m_buttonPanel.AccessibleName = "DropDownButtonPanel";
            m_buttonPanel.Dock           = DockStyle.Right;
            m_buttonPanel.BackColor      = Color.Transparent;
            m_buttonPanel.Controls.Add(m_button);
            this.Controls.Add(m_buttonPanel);

            HasBorder      = true;
            Padding        = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
            base.BackColor = SystemColors.Window;

            m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

            // Create the list.
            m_popupTree = new PopupTree();
            m_popupTree.TabStopControl = m_comboTextBox;
            //m_tree.SelectedIndexChanged += new EventHandler(m_listBox_SelectedIndexChanged);
            //m_listBox.SameItemSelected += new EventHandler(m_listBox_SameItemSelected);
            m_popupTree.AfterSelect     += new TreeViewEventHandler(m_tree_AfterSelect);
            m_popupTree.BeforeSelect    += new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
            m_popupTree.Load            += new EventHandler(m_tree_Load);
            m_popupTree.PopupTreeClosed += new TreeViewEventHandler(m_popupTree_PopupTreeClosed);
            m_popupTree.VisibleChanged  += new EventHandler(m_popupTree_VisibleChanged);

            this.ResumeLayout();
        }