Hi,
I have an UltraCombo.
I want to do something whenever the selection was changed.
Problem is, that UltraCombo doesn't have this event.
ValueChange event occures even if I didn't change the selection, so it doesn't help.
Which event can I use instead?
Thanks a lot,Yael
ValueChanged only fires when the value of the Combo changes. So this will fire when you select an item from the list or if the user types something into the edit portion of the control.
There's no way to distinguish between a user changing the value via selection or via typing.
It's good that the event will fire when selecting an item or when the user types something.
Problem is, that the event fires also when the ultra combo is initialized. In this case I don't want the event to fire.Do you have an idea why does it happen?
Thanks,Yael
Hi Yael,
You will have to ignore the event when you are setting it in code. You could do that in any number of ways. You could use a flag when you set the Value on the control so you know not to process the change. You could unhook the event when you set the property and re-hook it afterward. You could ignore the event when the control does not have focus.
Thanks!The solution was really simple:
if
(ultraCombo.Focused)....MyCode...
There is no good way to differentiate whether ValueChanged occurred because of a user typing or selecting an item from the list.
You could use the IsItemInList method to determine if the new value is on the list, but this can still occur when the user types something that matches an item on the list.
If you don't want the user to be able to type into the combo and only allow them to select from the list, then you can set the DropDownStyle property to DropDownList. This is the same way it works in the MS Combo.
I have a requirement with UltraCombo. I have added ValueChangedEvent handler to know which value selected and I need to do some work with that value. But It is valid only if the value is selected from the list. However I observed that this handler is called even when I type a character in the field. As I said, I need handler only when some one selected a value from the ComboBox.
For example, I have list of values(ABC, DEF and GHI), Suppose if I select a value from the list, I will get either ABC or DEF or GHI. But some one may type ABC or DEF or GHI in the field as well. I need a handler which should be called when I select a value from the list or when I type ABC(completely) but not for single character typing.
One way to do this, we need to disable typing mechanism and add just a Selection change handler.But I did n't see any such handler.
Can anyone point me to correct solution.
Thanks,
Sanjeev.
Why not just use the Enter event instead of BeforeDropDown?
I am facing an issue in similar line.
I have a method that wires to BeforeDropDown event to remove the already used option of drop down. It has been working fine but when the user use the Tab to navigate to the drop down (within UltraGrid) and Key Down to select the drop down the event attached to eforeDropDown won't fire.
How can I get this event to fire? I don't see an Key down or focus or Enter event handler where I can wire my event.
You answe will be greately appreciated.