CMFCDisableMenuAnimation Class

Disables pop-up menu animation.

class CMFCDisableMenuAnimation

Members

Public Constructors

Name

Description

CMFCDisableMenuAnimation::CMFCDisableMenuAnimation

Constructs a CMFCDisableMenuAnimation object.

CMFCDisableMenuAnimation::~CMFCDisableMenuAnimation

Destructor.

Public Methods

Name

Description

CMFCDisableMenuAnimation::Restore

Restores the previous animation that the framework used to display a pop-up menu.

Data Members

Name

Description

CMFCDisableMenuAnimation::m_animType

Stores the previous pop-up menu animation type.

Remarks

Use this helper class to temporarily disable pop-up menu animation (for example, when you process mouse or keyboard commands).

A CMFCDisableMenuAnimation object disables pop-up menu animation during its lifetime. The constructor stores the current pop-up menu animation type in the m_animType field and sets the current animation type to CMFCPopupMenu::NO_ANIMATION. The destructor restores the previous animation type.

You can create a CMFCDisableMenuAnimation object on the stack to disable pop-up menu animation throughout a single function. If you want to disable popup menu animation between functions, create a CMFCDisableMenuAnimation object on the heap and then delete it when you want to restore pop-up menu animation.

Example

The following example shows how to use the stack to temporarily disable menu animation.

void CMyApp::ProcessCommand()
{
   // Temporarily disable menu animation. 
   CMFCDisableMenuAnimation disableMenuAnimation;

   // TODO: Process the command here.

   // When the CMFCDisableMenuAnimation object leaves scope,
   // the destructor will restore the previous animation type.
}

Inheritance Hierarchy

CMFCDisableMenuAnimation

Requirements

Header: afxpopupmenu.h

See Also

Reference

Hierarchy Chart

CMFCPopupMenu Class

Other Resources

MFC Classes