Combo Box w/Edit Control & Owner-Draw Style Incompatible

Last reviewed: November 2, 1995
Article ID: Q82078
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) versions 3.1
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

The owner-draw combo box styles (CBS_OWNERDRAWFIXED and CBS_OWNERDRAWVARIABLE) are incompatible with the combo box styles that contain an edit control (combo box styles CBS_SIMPLE and CBS_DROPDOWN). A combo box with either the CBS_SIMPLE or CBS_DROPDOWN style displays the currently selected item in its associated edit control. When an owner-draw style is specified for the combo box style CBS_SIMPLE or CBS_DROPDOWN, the current selection may not be displayed. Using the SetWindowText function to display the current selection in response to a CBN_SELCHANGE message may not be effective.

MORE INFORMATION

An owner-draw combo box can contain bitmaps or other graphic elements in its list box. Therefore, to correctly display the current selection, it is necessary to display a bitmap or other graphic element in the edit control. Because edit controls are not designed to display graphics, there is no natural method to display the current selection in an owner-draw combo box with an edit control.

The combo box style CBS_DROPDOWNLIST, which has a static text area instead of an edit control, can display any item, including graphics. Use this style combo box with the owner-draw styles.


Additional reference words: 3.00 3.10 3.50 4.00 95
KBCategory: kbui
KBSubcategory: UsrCtl


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.