I derived a ComboBox of mine from ComboBoxExt and I am using a CheckedListBox a its ListControl.
I decided to derive because I want the TextBox to display all the currently checked items separated by comma.
Now I''d like to be able to check more than one item without having to press the dropdown button each time to show the listbox.
I looked at the source code of the control, but could not find a way to trap the click on the checkboxes so that I could stop the popup window from closing up.
It seems that the relevant methods are private and I can''t get at them.
Can you help, please?
ADAdministrator Syncfusion Team September 7, 2004 08:11 PM
You could handle the ComboBoxExt''s DropDownCloseOnClick event set its Cancel property to true for this purpose.
private void comboBoxExt1_DropDownCloseOnClick(object sender, Syncfusion.Windows.Forms.Tools.MouseClickCancelEventArgs args)
args.Cancel = true;
I have created a test sample as per your specifications above (i.e., allow multiple selections without closing the dropdown and all the selections are displayed in the Text with each item being separated by a comma), and have attached it here. Please refer to it and let me know if you need further assistance. We appreciate your interest in Syncfusion products.
RRRaul RosenthalSeptember 8, 2004 06:35 AM
Hmm, I tried but it does not work very well.
In your sample, all is fine, but you have to click twice on the checkboxes (the first click just selects the item)
I prefer the derived class approach, because I need a bunch of controls and I''d rather prefer not to duplicate the code in the DropDownCloseOnClick event handler.
I overrode GetPopupText and OnDropDownCloseOnClick.
GetPopupText build a string with the checked items separated by comma.
OnDropDownCloseOnClick is as follows:
protected override void OnDropDownCloseOnClick(Syncfusion.Windows.Forms.Tools.MouseClickCancelEventArgs args)
args.Cancel = true;
base.OnDropDownCloseOnClick( args );
Text = GetPopupText();
I get the same behaviour as your sample regarding the need to click twice on the checkboxes.
Moreover, when the code in OnDropDownCloseOnClick is executed the checkbox if not checked yet, so the Text field is not updated as expected.
ADAdministrator Syncfusion Team September 8, 2004 03:13 PM
Thanks for sharing your solution with us. Please let me know if you need any other information. We appreciate your continued interest in Syncfusion products.