Hello
How can I set the control, so that:
1) It auto-completes.2) The completion is limited to the listed items.3) If nothing is selected, the control can lose focus.
Thanks a lot.
Try something like this:
private void Form1_Load(object sender, EventArgs e) { this.ultraComboEditor1.AutoComplete = true; this.ultraComboEditor1.LimitToList = true; } private void ultraComboEditor1_ItemNotInList(object sender, Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs e) { if (e.InvalidText == null || e.InvalidText.Length == 0) { e.RetainFocus = false; } }
Mike,
This ItemNotInList event code works fine when placed in a form containing the ComboEditor, but when I place the event handler in a sub-classed ComboEditor class (ie MyComboEditor), it doesn't behave properly.
The event triggers ok and RetainFocus successfully sets to false, but the control still doesn't release focus afterwards. It only seems to behave when you click in and out of the control without typing or selecting anything.
I'm wanting to use this behaviour on all my Combos, so any ideas on why it doesn't work in a sub-classed control?
Hi,
I don't understand what you are asking. The whole point of the LimitToList property is that code was to make sure the user cannot enter something that is not on the list.
So why would you use this code if you want the user to be able to type something that's not on the list? That doesn't make sense.
Hello,
I use the code that you give on the second message but I need some help.
In case that the value typed by the user is out of the valueList range, the user cannot type anything else.
For example, my valueList contains [0,360}. If my user wanted to type the value 361 it wont let them type the three charatcter but only "36".
How can I do this?
If the base method is not accessible to a derived class, then that's a bug. But I doubt that has anything to do with the problem you are experiencing.
I recommend reporting both issues by Submit an incident to Infragistics Developer Support.
Include a small sample project demonstrating the behavior so they can see what's going on.
I'm hooking the ItemNotInList event in the InitializeComponent() method of my control, and there is almost nothing else in that derived control except some formatting properties being set in InitializeComponent as well.
Checked to make sure nothing else in the whole app references an ItemNotInList event, so I don't think anything else is grabbing it.
Interestingly though when I tried to override OnItemNotInList to test that, I tried to put a base.OnItemNotInList() call in there, but it doesn't seem accessible for UltraComboEditor. Almost all the other OnEvent... invokes for the combo seemed available, but not that one...
Is that something of consequence?
I can't see any reason why handling it in a derived control would be any different. Unless the application itself is also handling the event.
How are you handling it in the derived control? Are you actually hooking the event? Or overring OnItemNotInList? Are you calling the base implementation?