CMFCRibbonComboBox Class
The CMFCRibbonComboBox class implements a combo box control that you can add to a ribbon bar, a ribbon panel, or a ribbon popup menu.
class CMFCRibbonComboBox : public CMFCRibbonEdit
Members
Constructors
Name |
Description |
---|---|
Constructs a CMFCRibbonComboBox object. |
Public Methods
Name |
Description |
---|---|
Appends a unique item to the list box. |
|
Deletes a specified item from the list box. |
|
Specifies whether the list box can change size when it drops down. |
|
Returns the index of the first item in the list box that matches a specified string. |
|
Returns the number of items in the list box. |
|
Gets the index of the currently selected item in the list box. |
|
Gets the height of the list box when the list box is dropped down. |
|
Returns the size of the combo box as displayed in intermediate mode. |
|
Returns the string associated with an item at a specified index in the list box. |
|
Returns the data associated with an item at a specified index in the list box. |
|
Indicates whether the control contains an edit box. |
|
Indicates whether or not the list box can be resized. |
|
Called by the framework when the user selects an item in the list box. |
|
Deletes all items from the list box and clears the edit box. |
|
Selects an item in the list box. |
|
Sets the height of the list box when it is dropped down. |
Remarks
The ribbon combo box consists of a list box combined with either a static label or label that can be edited by the user. You must specify which type you want when you create your ribbon combo box.
Example
The following example demonstrates how to construct an object of the CMFCRibbonComboBox class, add an item to the combo box, select an item in the combo box, and add a combo box to a panel.
// Create a simple combo box with two entries:
// The first parameter is the id of the combo box.
// The third parameter is the width of the combo box in pixels.
// The fourth parameter is the display label of the combo box.
// The fifth parameter is the index of the small image of the combo box.
CMFCRibbonComboBox *pComboSimple = new CMFCRibbonComboBox(-1, FALSE, -1, 0, -1);
// Add two items to the combo box and select the first item in the list:
pComboSimple->AddItem(_T("Hi!"));
pComboSimple->AddItem(_T("Hello!"));
pComboSimple->SelectItem(0);
// Add combo button to "Favorites" panel:
// CMFCRibbonPanel* pPanelFavorites
pPanelFavorites->Add(pComboSimple);
Inheritance Hierarchy
Requirements
Header: afxribboncombobox.h