INFO: The Parts of a Windows Combo Box and How They Relate

ID: Q65881


The information in this article applies to:


SUMMARY

A Windows combo box is a compound structure composed of individual windows. Three types of windows can be created as part of a combo box:

The relationship among these three windows varies depending upon the different combo box styles.


MORE INFORMATION

For combo boxes created with the CBS_SIMPLE styles, the ComboBox window is the parent of the edit control and the list box that is always displayed on the screen. When GetWindowRect() is called for a combo box of this style, the rectangle returned contains the edit control and the list box.

Combo boxes created with the CBS_DROPDOWNLIST style have no edit control. The region of the combo box that displays the current selection is in the ComboBox window itself. When GetWindowRect() is called for a combo box of this style, the rectangle returned does not include the list box.

For combo boxes created with the CBS_DROPDOWN style, three windows are created. The combo box edit control is a child of the ComboBox window. When GetWindowRect() is called for a combo box of this style, the rectangle returned does not include the list box.

However, the ComboLBox (list box) window for combo boxes that have the CBS_DROPDOWN or CBS_DROPDOWNLIST style is not a child of the ComboBox window. Instead, each ComboLBox window is a child of the desktop window. This is required so that, when the drop-down list box is dropped, it can extend outside the application window or dialog box. Otherwise, the list box would be clipped at the window or dialog box border.

Because the ComboLBox window is not a child of the ComboBox window, there is no simple method to get the handle of one window, given the other. For example, given a handle to the ComboBox, the handle to any associated drop- down list box is not readily available. The ComboLBox is a private class registered by USER that is a list box with the class style CS_SAVEBITS.

Additional query words: control focus release win16sdk


Keywords          : kbComboBox kbCtrl kbNTOS kbGrpUser kbWinOS 
Version           : 
Platform          : 
Issue type        : kbinfo 

Last Reviewed: March 5, 1999