Share via


CCmdUI Class

Is used only within an ON_UPDATE_COMMAND_UI handler in a CCmdTarget-derived class.

class CCmdUI

Members

Public Methods

Name

Description

CCmdUI::ContinueRouting

Tells the command-routing mechanism to continue routing the current message down the chain of handlers.

CCmdUI::Enable

Enables or disables the user-interface item for this command.

CCmdUI::SetCheck

Sets the check state of the user-interface item for this command.

CCmdUI::SetRadio

Like the SetCheck member function, but operates on radio groups.

CCmdUI::SetText

Sets the text for the user-interface item for this command.

Public Data Members

Name

Description

CCmdUI::m_nID

The ID of the user-interface object.

CCmdUI::m_nIndex

The index of the user-interface object.

CCmdUI::m_pMenu

Points to the menu represented by the CCmdUI object.

CCmdUI::m_pOther

Points to the window object that sent the notification.

CCmdUI::m_pSubMenu

Points to the contained sub-menu represented by the CCmdUI object.

Remarks

CCmdUI does not have a base class.

When a user of your application pulls down a menu, each menu item needs to know whether it should be displayed as enabled or disabled. The target of a menu command provides this information by implementing an ON_UPDATE_COMMAND_UI handler. For each of the command user-interface objects in your application, use the Properties window to create a message-map entry and function prototype for each handler.

When the menu is pulled down, the framework searches for and calls each ON_UPDATE_COMMAND_UI handler, each handler calls CCmdUI member functions such as Enable and Check, and the framework then appropriately displays each menu item.

A menu item can be replaced with a control-bar button or other command user-interface object without changing the code within the ON_UPDATE_COMMAND_UI handler.

The following table summarizes the effect CCmdUI's member functions have on various command user-interface items.

User-Interface Item

Enable

SetCheck

SetRadio

SetText

Menu item

Enables or disables

Checks (×) or unchecks

Checks using dot (•)

Sets item text

Toolbar button

Enables or disables

Selects, unselects, or indeterminate

Same as SetCheck

(Not applicable)

Status-bar pane

Makes text visible or invisible

Sets pop-out or normal border

Same as SetCheck

Sets pane text

Normal button in CDialogBar

Enables or disables

Checks or unchecks check box

Same as SetCheck

Sets button text

Normal control in CDialogBar

Enables or disables

(Not applicable)

(Not applicable)

Sets window text

For more on the use of this class, see How to Update User-Interface Objects.

Inheritance Hierarchy

CCmdUI

Requirements

Header: afxwin.h

See Also

Reference

Hierarchy Chart

CCmdTarget Class

Concepts

MFC Sample MDI