Hello,
I am using a UltraCombo to display a list of names in a drop down grid as matched by user input using AutoCompleteMode = Suggest. Due to the extremely large amount of names, I am populating the DataSource after the 3rd character typed from a web service. What I would like to do is keep the drop down list (grid with name details) visible at all times so that the user can see when data is available from an asyncronous call, or that there are no matches to thier input. When I enter the UltraCombo, I call ToggleDropDown() to display the empty drop down grid and then as data is available from the web service, it shows up in the list after I set the DataSource, which is exactly what I want so far. The problem is that if I backspace and change the text to something not in the newly populated list, the drop down disappears, and when new data is set to the UltraCombo's DataSource, its not visible to the user. If I call ToggleDropDown() when I get a set the DataSource,it shows the grid but it highlights the text input, which the user could still by typing, and could then type over thier existing text. Is there a way to keep the drop down visible at all times as long as the UltraCombo has the focus?
Thanks for the help,
Rob
Hi Rob,
I guess the question is.. what is causing the dropdown to close. You must be doing something in the code that is triggering the closeup and in order to prevent it, you need to find out exactly what it is.
So what happens when you press backspace and the list gets cleared? My guess is that maybe you are setting the data source to null, rather then simply emptying out the list. But that's only a guess since I don't have any idea what your code might be doing.
Hi Mike,
Thanks for the response. I would like to also clarify I am using a System.Windows.Form.BindingSource as the DataSource for the UltraCombo.DataSource, and I am changing the BindingSource's DataSource as I fetch new data. The first step is that I set the BindingSource's DataSource = typeof(<MyBusinessObject>), then in an overriden OnEnter I ToggleDropdown(). From here, I can type 2 characters, backspace, etc and it shows the dropdown with no data since the user hasnt typed the 3rd character. Lets say the user then types "Wil" to lookup a name "Williams". On the 3rd character, I fire an asynchronous call to a webservice to get all people that match "Wil", which returns all people that start with "Wil" ("Wilson","Williams", etc). Also, an observation I have made is that if the user is able to type the full text of "Williams" before the asynchronous call completes which changes the BindingSource's DataSource, that the drop down list/grid has not removed entries that start with "Wil" but that dont match the full "Williams", but instead scrolled to "Williams" in the list. If it returns before typing is complete, then as the user types, it removes the non-matching entries from the drop down. Also, from here, with the list visible and no data changes programmatically, if the user types "Williamson", but there are no matching entries, the list disappears. If they backspace back to "Williams", it reappears with the matching results. Also, if they backspace all the way to "W", the list will stay visible since "W" exists in the results. Now, if perhaps they were looking at the wrong name, and they wanted to look for "Smith", as soon as they go back and type "S" the list disapears. None of the data has changed at this point since the last character sequence to populate the data was "Wil". As soon as the user has types "Smi", the call fires to retrieve matching data, but when he call returns and populates the DataSource, the drop down is now hidden and doesnt reappear as text changes, and the user doesnt realize there are matches.
I am sorry if this is long winded, I just wanted to give you as much information as I could. I am new to Infragistics, but if I had to guess, it relates to the filter process. I would like to be able to show an empty drop down grid when there are no matches, instead of losing the drop down.
Thanks again for the help,
Rob Stallworth
Here is basically the code:
public class UltraNameCombo : Infragistics.Win.UltraWinGrid.UltraCombo{ private System.Windows.Forms.BindingSource bs = new System.Windows.Forms.BindingSource(); private string _lookedUpText = string.Empty; public UltraNameCombo() { AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest; bs.DataSource = typeof(MasterName); DataSource = bs; ValueMember = "SurName"; DisplayMember = "SurName"; } protected override void OnEnter(EventArgs e) { ToggleDropdown(); base.OnEnter(e); } protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e) { if (Text.Length == 3 && Text != _lookedUpText) LookupName(); base.OnKeyPress(e); } void LookupName() { _lookedUpText = Text; //create webservice webservice.LookupNameCompleted+=new LookupNameCompletedEventHandler(service_LookupNameCompleted); webservice.LookupNameAsync(_lookedUpText); } void service_LookupNameCompleted(object sender, LookupNameCompletedEventArgs e) { bs.DataSource = e.Result; }}
Well, as I said, something in your code must be causing the dropdown to close. So you need to find out what that is. Maybe you could put a breakpoint in the CloseUp event of the control and then examine the call stack to see what is making it close.
I am not in luck since my version of Infragistics is from 2008. But I think Mike's tip will help me, with this workaround I should get my multi select combo box ! :)
If you are using version 2009 Volume 1 and later you can take advantage of the
CheckedListSettings property off UltraCombo. Also you will need to set the
CheckedListSettings.ItemCheckArea property to Item, so that the drop down list does not close when an item is being clicked. By default, the ItemCheckArea property is set to Checkbox.
What version of the controls are you using? We added multi-select support to the combo a few volume release ago via the CheckListSettings property.
NetAdvantage® WindowsForms Online Help :: 2010.1
If you don't have that property on your UltraCombo, then you are probably using an older version, in which case, you might want to check out this KB article, which shows you how to do it the old (more difficult) way:
HOWTO:Creating a Multi-Select Dropdown Combo for the WinGrid
ok I think I have to explain my point a little better, so forget what I wrote before... :)
I have an UltraCombo drop down with a list of selectable items. The problem is: the drop down list closes every time I click on an item. What I actually want is that I can select several items and only then choose to close the drop down.
Since it does not seem to be possible to keep the drop down list visible by a setting of the control, I am trying to figure out a way to reopen the list as soon as it closes up. But I could not make it with an event like AfterCloseUp, the function toggleDropDown seems to have no effect.
So my actual question is : is it only possible to "Keep UltraCombo drop down list visible" ?
Hi
It looks like we may have been having a problem with our forums at the time you posted here, so I never got a notification of your post.
Anyway... I'm a little lost on what your question is. You are not sure how to hook an event on a control? This is one of the simplest and most basic things you can do when programming in Visual Studio and you would hardly be able to write even the simplest application without know how to do this, so I'm sure I must be misunderstanding the question. :)