CComboBox Class |
Description
The CComboBox class is used to create and manage a ComboBox control. A ComboBox control displays a drop-down list of predefined values and an edit field into which the user can enter a value.
Refer to the documentation that ships with the Microsoft Windows Software Development Kit for more information on the use of combo box controls.
CComboBox Members
CComboBox | CComboBox();Constructor for the CComboBox. |
AddString | int AddString(LPCTSTR lpszString) const;Adds a string to the list. |
Clear | void Clear() const;Deletes the edit selection. |
Copy | void Copy() const;Copies the edit selection to the clipboard. |
Cut | void Cut() const;Deletes the edit selection and places it on the clipboard. |
DeleteString | int DeleteString(int nIndex) const;Deletes a string from the list. |
Dir | int Dir(UINT attr, LPCTSTR lpszWildCard ) const;Adds the file names matching the specified attributes and path to the list. |
FindString | int FindString(int nIndexStart, LPCTSTR lpszString) const;Searches the list box of the combo box for an item beginning with the characters in a specified string. |
FindStringExact | int FindStringExact(int nIndexStart, LPCTSTR lpszString) const;Returns the index of the first list item exactly matching the specified string. |
GetCount | int GetCount() const;Returns the number of list items. |
GetCurSel | int GetCurSel() const;Returns the index of the currently selected item, if any. |
GetDroppedControlRect | CRect GetDroppedControlRect() const;Fills the specified rectangle structure with the screen coordinates of a drop-down list. |
GetDroppedState | BOOL GetDroppedState() const;Returns TRUE if a drop-down list is open, otherwise it returns FALSE. |
GetDroppedWidth | int GetDroppedWidth() const;Returns the minimum allowable width, in pixels, of the drop-down list. |
GetEditSel | DWORD GetEditSel() const;Returns the starting and ending position of the current selection. |
GetExtendedUI | BOOL GetExtendedUI() const;Returns TRUE if the combo box is a drop-down combo box or drop-down list box and the user-interface flag is set, otherwise it returns FALSE. |
GetHorizontalExtent | int GetHorizontalExtent() const;Returns the scrollable width, in pixels, of the drop-down list. |
GetItemData | DWORD GetItemData(int nIndex) const;Returns the value associated with the specified list item. |
GetItemHeight | int GetItemHeight(int nIndex) const;Returns the height, in pixels, of the specified owner-drawn list item. |
GetLBText | int GetLBText(int nIndex, LPTSTR lpszText) const;Copies the specified list text to the specified buffer. |
GetLBTextLen | int GetLBTextLen(int nIndex) const;Returns the length, in TCHARs, of the specified list text. |
GetLocale | LCID GetLocale() const;Returns the current locale for the list. |
GetTopIndex | int GetTopIndex() const;Returns the index of the first visible item in the drop-down list. |
InitStorage | int InitStorage(int nItems, int nBytes) const;Initializes space for the specified number of items and the specified number of bytes for item strings. |
InsertString | int InsertString(int nIndex, LPCTSTR lpszString) const;Inserts a list item at the specified position. |
LimitText | void LimitText(int nMaxChars) const;Sets the maximum number of characters a user can enter in the edit control. |
Paste | void Paste() const;Replaces the edit selection with the contents of the clipboard. |
ResetContent | void ResetContent() const;Removes the contents of the list. |
SelectString | int SelectString(int nStartAfter, LPCTSTR lpszString) const;Selects the first list item, if any, that begins with the characters in the specified text. |
SetCurSel | int SetCurSel(int nIndex) const;Sets the current selection. |
SetDroppedWidth | int SetDroppedWidth(int nWidth) const;Sets the minimum allowable width, in pixels, of the drop-down list. |
SetEditSel | BOOL SetEditSel(int nStartChar, int nEndChar) const;Selects the specified range of text. |
SetExtendedUI | int SetExtendedUI(BOOL bExtended = TRUE) const;Sets or clears the extended user-interface flag. This flag changes the keys that open and close the list in a drop-down list. |
SetHorizontalExtent | void SetHorizontalExtent(UINT nExtent ) const;Sets the scrollable width, in pixels, of the drop-down list. |
SetItemData | int SetItemData(int nIndex, DWORD dwItemData) const;Associates the specified value with a list item. |
SetItemHeight | int SetItemHeight(int nIndex, UINT cyItemHeight) const;Sets the height of the specified owner-drawn list item or the selection field. |
SetLocale | LCID SetLocale( LCID NewLocale ) const;Sets the current local for the list. |
SetTopIndex | SetTopIndex(int nIndex) const;Scroll the drop-down list so the specified item is at the top of the visible range. |
ShowDropDown | void ShowDropDown(BOOL bShow = TRUE) const;Shows or hide the drop-down list. |
Overridables
PreRegisterClass | virtual void PreRegisterClass(WNDCLASS &wc);Set the window class parameters before the window is created. |
Base class Members
For base class members, refer to the members of CWnd.
Remarks
Like all common controls, theĀ combobox control requires a parent window. This parent window is often a dialog, but simple windows can also be the parent window for an combobox control.
Summary Information
Header file | controls.h |
Win32/64 support | Yes |
WinCE support | Yes |