.

Why is the amount of text I can type in my combo box limited by its width?

Once in a while you’ll stumble upon a combo box which doesn’t allow you to type past the right edge of the control. When normally typing more text would just scroll the contents, you’ll just get back an annoying beep. The amount of text you can enter is actually bound by the on-screen width of the text – thus, you may be able to enter 125 “i” characters, but only 25 “W” characters.

The cause of the problem is that the combo box was not created with the CBS_AUTOHSCROLL style:

CBS_AUTOHSCROLL
Automatically scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

Visual Studio’s resource editor has a different name and description for this property:

Auto
Automatically scrolls text to the left when the user types a character at the end of the line.

Comments