|Date:||March 10, 2006 / year-entry #89|
|Summary:||Many people are surprised to discover that when you create a combo box (either in code via CreateWindow or indirectly via a dialog box template), the size you specify describes the size of the combo box including the drop-down list box, even though the drop-down list box is not visible on the screen. For example,...|
Many people are surprised to discover that when you create a combo box (either in code via
But I still haven't answered the question, "Why does the size of a combo box include the size of the drop-down?" The reason is that the original combo box did not have a drop-down. Originally, a combo box was just an edit control and a list box glued together. (You can still see this "old-timey-style combo box" in Notepad's Font dialog.) You can think of the original combo box as a modern combo box where the drop-down was pinned open. Under this original design, it was reasonable for the size of the combo box to include both the edit control and the list box, since that's how much space it took up.
When the "drop-down" style of combo box was invented, the designers wanted to make the transition from "old-timey combo box" to "slick new drop-down combo box" as easy as possible, so the sizing behavior was retained so that code and dialog boxes wouldn't have to change to take advantage of the new drop-down style combo box aside from changing to the
And that's why the size of a combo box includes the size of the drop-down. It's a chain of backwards compatibility going all the way back to the old-timey days before combo boxes learned how to drop down.
<-- Back to Old New Thing Archive Index