We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I know, that a ComboBox's drop down list has closed?

Thread ID:

Created:

Updated:

Platform:

Replies:

762 Aug 14,2002 04:06 AM Aug 15,2002 02:02 AM Windows Forms 3
loading
Tags: GridControl
Michael Marake
Asked On August 14, 2002 04:06 AM

I want to know the exact point of time, when the drop down list of a ComboBox has closed, respectively when the user has finished choosing from the list (SelectionChangeComitted). I cannot use the CurrentCellChanged event, because this event is fired each time items from the list are selected with the keyboard's arrow keys. I cannot use the CurrentCellEditingComplete event, because it is fired after leaving the cell. Thanks, Michael

Clay Burch [Syncfusion]
Replied On August 14, 2002 10:30 AM

The GridComboBoxCellRenderer has a DropDownContainer.CloseUp event that you can catch. To hook it, at the bottom of your Form_Load event, get a reference to the combobox cell renderer, and then use that to subscribe to this event.
private void Form1_Load(object sender, System.EventArgs e)
{
	....
	....

	GridComboBoxCellRenderer cbb  = (GridComboBoxCellRenderer) this.gridControl1.CellRenderers["ComboBox"];
	cbb.DropDownContainer.CloseUp += new PopupClosedEventHandler(ComboBoxClosed);
}

private void ComboBoxClosed(object sender, PopupClosedEventArgs e)
{
	Console.WriteLine("ComboBoxClosed");
}

Michael Marake
Replied On August 15, 2002 01:06 AM

Thanks, that seems to work fine. But when would I subscribe to the CloseUp event in a grid that derives from GridControl? The ComboBoxCellRenderer is not yet in the CellRenderers collection during construction of the grid.

Clay Burch [Syncfusion]
Replied On August 15, 2002 02:02 AM

One thing you could do is to subscribe to the grid's Paint event, and hook the CloseUp there, and also unhook the Paint event handler. This way the Paint event handler is only executed once. public class MyGridControl : GridControl { public MyGridControl():base() { this.Paint += new PaintEventHandler(HookDropDown); } private void HookDropDown(object sender, PaintEventArgs pe) { GridComboBoxCellRenderer cbb = (GridComboBoxCellRenderer) this.CellRenderers["ComboBox"]; cbb.DropDownContainer.CloseUp += new PopupClosedEventHandler(ComboBoxClosed); Console.WriteLine("HookDropDown - should see only once"); this.Paint -= new PaintEventHandler(HookDropDown); } private void ComboBoxClosed(object sender, PopupClosedEventArgs e) { Console.WriteLine("ComboBoxClosed"); } }

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;