Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
class CComboBox
CWnd                                        Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  The CComboBox class provides the functionality of a Windows combo box. A
  combo box consists of an edit control plus a list box. The list box may
  be displayed at all times or may be dropped down when the user selects a
  drop-down arrow next to the edit control, depending on the style of
  the combo box.
 
  Depending on the style of the combo box, the user may or may not be able
  to edit the contents of the edit control. If the list box is visible,
  typing characters into the edit control will cause the first list-box
  entry that matches the characters typed to be highlighted. Conversely,
  selecting an item in the list box displays the selected text in the edit
  control.
 
  You create a combo box in two steps. First call the constructor
  CComboBox to construct the CComboBox object, then call the Create
  member function to create the button control and attach it to the
  CComboBox object.
 
  Construction can be a one-step process in a class derived from
  CComboBox. Write a constructor for the derived class and call Create
  from within the constructor.
 
  If you want to handle the Windows notification messages sent by a
  CComboBox object to its parent (usually a class derived from CDialog or
  CModalDialog), add the appropriate message-map entries and
  message-handler member functions to the parent class to handle the
  messages you want to process. Potential message-map entries are:
 
  ON_COMMAND
  ON_CBN_KILLFOCUS
  ON_CBN_SETFOCUS
  ON_CBN_DROPDOWN
  ON_CBN_DBLCLK
  ON_CBN_ERRSPACE
  ON_CBN_SELCHANGE
  ON_CBN_EDITCHANGE
  ON_CBN_EDITUPDATE
 
  If you create a CComboBox object within a dialog box (through a dialog
  resource), the CComboBox is automatically destroyed when the user closes
  the dialog box.
 
  If you create a CComboBox object within a window, you may also need to
  destroy it. If you create the CComboBox object on the stack, it is
  destroyed automatically. If you create the CComboBox object on the heap
  by using the new function, you must call delete on the object to destroy
  it when the user terminates the Windows combo box.
 
  If you allocate any memory in the CComboBox object, override the
  CComboBox destructor to dispose of the allocations.
 
  See Also
 
  CWnd, CButton, CEdit, CListBox, CScrollBar, CStatic,
  CModalDialog, CDialog
 
  Public Members
 
  Construction/Destruction
 
  CComboBox   Constructs a CComboBox object.
 
  Initialization
 
  Create   Creates the combo box and attaches it to the CComboBox
             object.
 
  General Operations
 
  GetCount       Retrieves the number of items in the list box of a
                   combo box.
 
  GetCurSel      Retrieves the index of the currently selected item, if
                   any, in the list box of a combo box.
 
  SetCurSel      Selects a string in the list box of a combo box.
 
  GetEditSel     Gets the starting and ending character positions of the
                   current selection in the edit control of a combo box.
 
  LimitText      Limits the length of the text that the user may enter
                   into the edit control of a combo box.
 
  SetEditSel     Select characters in the edit control of a combo box.
 
  GetItemData    Retrieves the application-supplied 32-bit value
                   associated with the specified combo-box item.
 
  SetItemData    Sets the 32-bit value associated with the specified
                   item in a combo box.
 
  GetLBText      Gets a string from the list box of a combo box.
 
  GetLBTextLen   Gets the length of a string in the list box of a combo
                   box.
 
  ShowDropDown   Shows or hides the list box of a combo box that has the
                   CBS_DROPDOWN or CBS_DROPDOWNLIST style.
 
  Clear          Deletes (clears) the current selection (if any) in the
                   edit control.
 
  Copy           Copies the current selection (if any) onto the
                   Clipboard in CF_TEXT format.
 
  Cut            Deletes (cuts) the current selection (if any) in the
                   edit control, and copies the deleted text onto the
                   Clipboard in CF_TEXT format.
 
  Paste          Inserts the data from the Clipboard into the edit
                   control at the current cursor position. Data is
                   inserted only if the Clipboard contains data in CF_TEXT
                   format.
 
  String Operations
 
  AddString      Adds a string to the end of the list in the list box of
                   a combo box, or at the sorted position for list boxes
                   with the CBS_SORT style.
 
  DeleteString   Deletes a string from the list box of a combo box.
 
  InsertString   Inserts a string into the list box of a combo box.
 
  ResetContent   Removes all items from the list box and edit control of
                   a combo box.
 
  Dir            Adds a list of filenames to the list box of a combo
                   box.
 
  FindString     Finds the first string that contains the specified
                   prefix in the list box of a combo box.
 
  SelectString   Searches for a string in the list box of a combo box
                   and, if the string is found, selects the string in the
                   list box and copies the string to the edit control.
 
  Windows 3.1 Functions
 
  SetItemHeight           Sets the height of list items in a combo box
                            or the height of the edit-control (or
                            static-text) portion of a combo box.
 
  GetItemHeight           Retrieves the height of list items in a combo
                            box.
 
  FindStringExact         Finds the first listbox string (in a combo
                            box) that matches the specified string.
 
  SetExtendedUI           Selects either the default user interface or
                            the extended user interface for a combo box
                            that has the CBS_DROPDOWN or
                            CBS_DROPDOWNLIST style.
 
  GetExtendedUI           Determines whether a combo box has the default
                            user interface or the extended user
                            interface.
 
  GetDroppedControlRect   Retrieves the screen coordinates of the
                            visible (dropped-down) list box of a drop-down
                            combo box.
 
  GetDroppedState         Determines whether the list box of a drop-down
                            combo box is visible (dropped down).
 
 
                                     -♦-