As I have a client who is demanding somewhat crowded forms with too much text displayed in their combos, I'm messing around trying to improve the behaviour of the ComboEditor when it contains text that is too long to fit in the editor.
I'm running with autocomplete on, and as soon as the user types in something that autocompletes to an item longer than the combo width, the focus shifts to the right-most part of the text and they can't see what they were typing any more. The same behaviour also happens with using the up-down keys to cycle between items in the list.
As the client has a strong preference to view the left-most part of the text, and form re-design to extend the combos is out of the question, anyone have ideas on how I might force the control to stay focused on the left part of the text?
I've had minor success with using Select(0, 0) to do this on AfterDropDown/AfterCloseUp, but this doesn't do the trick in any other events.
I don't have any conrete ideas for you here. But it might help you to know that when the combo goes into edit mode, it display an Inbox TextBox control over itself to handle the editing. So you might want to see if it's possible to do this with a Microsoft TextBox. If so, you can do someting like combo.Controls[0] to get a reference to the TextBox control and deal with it directly. This will, of course, only work when the control is in edit mode.
Thanks Mike,
The inbox control looks like it offers a few more position functions (like ScrollToCaret), but after trying lots of combinations I still can't see any visible result on screen. It almost seems like something else on the ComboEditor is overriding my action afterwards, as I can't see any indication that things like Select(), SelectionStart etc are having an effect.
I'm placing my code in the KeyDown() event handler for the Up/Down keys at the moment for testing, so I wonder whether this event runs too early to be of use? Maybe autocomplete or something else kicks in later?