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.
It sounds like you could do what you want by using the ItemNotInList event and prompting the user with a MessageBox or another dialog to allow them to create the new contact record.
Another option would be to use add a button the Combo itself using ButtonsRight or ButtonsLeft. A user could click this button without losing focus on the control, so the LimitToList would not be a problem.
BTW, if you set DropDownStyle to DropDownList, the user can still type into the combo and find a match. The searching works a little differently by default, though. It only searches the first character. But you can change this by setting AutoComplete or AutoEdit (I forget which) to true.
HI Mike,
I can use this event to accomplish what I want. I did try setting the DropDownStyle to DropDownList and setting AutoEdit to true but that didn't give me the type ahead functinality that I want. It is still just going to the first letter of value in the list.
BTW, is there a way to kill the last key stock received in this event? So it would stop the type ahead until it found the next set of matching data.
Thanks,
You can only stop a key from reaching the control using the KeyDown or maybe KeyPress events. You could trap one of these events and then use the IsItemInList method to check for the existance of an item on the list yourself, without using LimitToList. That's another option.
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.
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.
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.
Michal Kozlowski said:where do I find these properties frim the UltraCombo class
Which properties? SelectionStart and SelectionLength should be right on the control.