CMFCRibbonUndoButton Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCRibbonUndoButton Class.

The CMFCRibbonUndoButton class implements a drop-down list button that contains the most recent user commands. Users can select one or more of the most recent commands from the drop-down list to either redo or undo them.

class CMFCRibbonUndoButton : public CMFCRibbonGallery  

Public Constructors

NameDescription
CMFCRibbonUndoButton::CMFCRibbonUndoButtonConstructs a new CMFCRibbonUndoButton object by using the command ID that you specify, text label and images from the image list of the parent object.

Public Methods

NameDescription
CMFCRibbonUndoButton::AddUndoActionAdds a new action to the list of actions.
CMFCRibbonUndoButton::CleanUpUndoListClears the action list, which is the drop-down list.
CMFCRibbonUndoButton::GetActionNumberDetermines the number of items that a user selected from the drop-down list.
CMFCRibbonUndoButton::HasMenuIndicates whether the object contains a menu.

The CMFCRibbonUndoButton class uses a stack to represent the drop-down list.

The following example demonstrates how to construct an object of the CMFCRibbonUndoButton class, and add a new action to the list of actions. This code snippet is part of the Ribbon Gadgets sample.

	// The third parameter is the zero-based index in the image list of the parent 
	// object for the button's small image.
	// The fourth parameter is the zero-based index in the image list of the parent object 
	// for the of button's large image.
	CMFCRibbonUndoButton* pBtn1 = new CMFCRibbonUndoButton(ID_RIBBON_OBTN_1, _T("Undo"), 0, 0);
	for (int i = 0; i < 20; i++)
	{
		CString str;
		str.Format(_T("Action %d"), i + 1);
		pBtn1->AddUndoAction(str);
	}

CObject

CMFCRibbonBaseElement

CMFCRibbonButton

CMFCRibbonGallery

CMFCRibbonUndoButton

Header: afxribbonundobutton.h

Adds a new action to the list of actions.

void AddUndoAction(LPCTSTR lpszLabel);

Parameters

[in] lpszLabel
The action label that will be displayed in the drop-down list.

Clears the action list, which is the drop-down list.

void CleanUpUndoList();

Constructs a new CMFCRibbonUndoButton object by using the command ID that you specify, text label and images from the image list of the parent object.

CMFCRibbonUndoButton(
    UINT nID,  
    LPCTSTR lpszText,  
    int nSmallImageIndex=-1,  
    int nLargeImageIndex=-1);

 
CMFCRibbonUndoButton(
    UINT nID,  
    LPCTSTR lpszText,  
    HICON hIcon);

Parameters

[in] nID
Specifies the command identifier.

[in] lpszText
Specifies the text label of the button.

[in] nSmallImageIndex
Zero-based index in the image list of the parent object for the button's small image.

[in] nLargeImageIndex
Zero-based index in the image list of the parent object for the of button's large image.

[in] hIcon
A handle to an icon that you can use as a button's image.

Determines the number of items that a user selected from the drop-down list.

int GetActionNumber() const;  

Return Value

The number of items that a user selected.

Indicates whether the object contains a menu.

virtual BOOL HasMenu() const;  

Return Value

Always returns TRUE.

Remarks

Hierarchy Chart
Classes
CMFCRibbonGallery Class
CMFCRibbonButton Class

Show: