This post is kind of similar to a previous posting (http://forums.infragistics.com/forums/p/3391/19040.aspx), which was about UltraDropDowns, and was never 100% answered.
Anyway, what I want is to be able to run some code as soon as the user selects an option in the UltraCombo. I have tried a few events, none of which are quite there:
AfterCloseUp - Fires no matter how the combo is closed up, by selecting an option, or just by closing it without selecting an option.
RowSelected - Fires every time the user moves from row to row within the combo, no matter if they selected an option or not.
ValueChanged - Fires as the user is typing an option in (when auto-complete kicks in).
AfterCloseUp looks like it would be the perfect place, if only I had a way of knowing if it was closed up because the user selected an option or if the user just closed it without selecting anything.
Anyone have any ideas?
From memory, there was no easy way of doing this. I had to handle both the AftercloseUp and OnValidated events. For both of them I had to check if the value had changed since the last time I did the "thing",and if it had changed, then do thte "thing" again.
I try to use this logic as seldom as possible. I dont think I use it for a databound field (it just gets too tricky if the user presses escape, which fires other code in my app which returns the field back to its original value). I think I only use it where the field is controling the look of the form it is on, so I can update other parts of the fields (hide/show controls, load data, etc).
Hi PC,
If you want to update something every time the combo changes, you will need to use the ValueChanged event.
I understand that this event will fire on almost every keystroke, but there is really no way around that because there's no way that the UltraCombo can possibly know when the user is finished typing.
So it seems to me that you will either need to use ValueChanged and validate the current Text in the control against the list (you can do this using the IsItemInList method).
Or, you will need to use a timer and perform your updates lazily.
Hi all,
I having a same problem right now.
Things should go like this, user select a data from ultracombo, then reflect some data in others text box or grid based on the selection of ultracombo. Im using AfterCloseUp function to cater the user selection, but I facing problem when they close the dropdown without select anything and use the KEYBOARD ARROW KEY to make the selection.
How can I get the selected data by ARROW KEY FROM KEYBOARD?
Please guide.
Warm regards,
PC
Hello fweeee,
You are right - you could use the 'AfterCloseUp' event. You could check in it if the left mouse button is clicked and if this was done on a cell in the WinCombo control.
Below is a my code sample:
private void ultraCombo1_AfterCloseUp(object sender, EventArgs e) { if (mouseCaptured .Button == MouseButtons.Left && ((Infragistics.Win.ControlUIElementBase)(ultraCombo1.DisplayLayout.UIElement)).LastElementEntered != null && ((Infragistics.Win.ControlUIElementBase)(ultraCombo1.DisplayLayout.UIElement)).LastElementEntered.GetType() == typeof(EditorWithTextDisplayTextUIElement)) { //Your code here... } } MouseEventArgs mouseCaptured; private void ultraCombo1_MouseClick(object sender, MouseEventArgs e) { mouseCaptured = e; }
Please review the above code and feel free to let me know if I misunderstood you or if you have any other questions.