Hello,
I have a UltraCombo with the property LimitToList set to true, but when some is tryprd that doesn't exist in the combo box the focus will not go outside of the combo box until a value is selected that exists in the combo. What I need is the ability enable a button when something is typed that doesn't exist in the combo and allow the user to be able to click that button without having to make a valid selection in the combo box. I don't want to lose the LimitToList funtionality because they like to be able to type to see if the value exists in the combo box.
Thanks in advance for any help.
Kris
Hi Kris,
I'm not sure I understand the question. You seem to be asking how you can have LimitToList and not have LimitToList at the same time. This is, of course, not possible.
The whole point of LimitToList is that it does not allow the user to leave the control with a value that is not on the list.
Hi Mike,
Here is my situation. The combo box is filled with contact names, and if the user types is a name in the combo and the name doesn't exist in the list then I want them to be able to click a button to create a contact record.
What I would like is the type ahead feature so they can go through the list by typing, but I also don't want them to be able type in a name that doesn't exist in the combo. I tried setting DropDownStyle to DropDownList but the type ahead feature doesn't work then.
It would be great if as they typed and a match wasn't found in the list then the key stroke is cancelled that way they could only key in items that exist is the list.
I hope that is clearer.
If I can't get it to work that way then I will just remove the LimitToList and do a check to see if the item exists in the list.
Thanks for your help.
The highlighting of the text is controlled by the SelectionStart and SelectionLength properties. Were you not aware of these two properties? O are you saying that they don't work inside KeyUp?
I'm having the same problem as Kris, and I have gotten to the same stage as him, where do I find these properties frim the UltraCombo class? I would like the behavior to appear to ignore the last key stroke if it is invalid, and keep the old selection.
Michal Kozlowski said:where do I find these properties frim the UltraCombo class
Which properties? SelectionStart and SelectionLength should be right on the control.
I also have a similar need as the users in the previous posts. The SelectedText, SelectionLength and SelectionStart properties are not part of the UltraCombo class directly, but are available from the TextBox control within UltraCombo. In my testing, I could not get values for these, despite the text in the control being partially selected. Might it matter that the control is embedded in a grid (as the EditorControl for a column in a WinGrid)? Thanks.
Yes, thet certainly does matter. The grid does not use the actual control on the form. The Control just provides an editor to the grid. But if you are using a grid, you should just be using the properties of the cell, you don't have to deal with the TextBox.
Well, most things that you override on the UltraCombo are not going to affect the grid. As I beleive I said somewhere earlier in this thread (or maybe it was another thread), the grid does not use the Control you assign as the EditorControl of a column or cell. The control simply provides a copy of it's internal editor. So if you are trapping Key event on your derived UltraCombo, these will not have any effect on the grid. The grid has it's own key events.
You cannot access the grid cell from the UltraCombo, because the UltraCombo knows nothing about the grid.
There is one small exception to this, and that is the EditorButton events. These will fire on the control, because the grid doesn't have corresponding events for them.
Thanks for the response Mike. How then do I access the cell properties of the containing grid from the UltraCombo? FWIW, I have sub-classed (derived) the UltraCombo into a custom version to handle some "unique" requirements. Since the custom control will be used many, many times, I would like to abstract as much functionality as possible away from the containing grid and into the control.