CCmdUI
CCmdUI does not have a base class.
CCmdUI没有基类。
The CCmdUI class is used only within an ON_UPDATE_COMMAND_UI handler in a CCmdTarget-derived class.
CCmdUI类只是被用在一个CCmdTarget派生类中的ON_UPDATE_COMMAND_UI(处理程序)中。
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. Use ClassWizard to browse the command user-interface objects in your application and create a message-map entry and function prototype for each handler.
当你的应用的用户拉出一个菜单时,每个菜单项(都)需要知道它应该被显示为可用还是禁用。菜单命令的目标通过执行(一段)ON_UPDATE_COMMAND_UI(处理程序)来提供此信息。(请)使用ClassWizard(类向导),来浏览你的应用中的命令用户接口物件,并创建消息映射入口和各个处理程序的函数原形。
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.
当菜单被拉出时,(框架)会寻找并调用各个ON_UPDATE_COMMAND_UI处理程序,每个处理程序调用CCmdUI中像Enable和Check这样的成员函数,然后框架将(按照其合适的方式)显示各个菜单项。
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.
菜单项可以用控件栏按钮或其它的命令用户接口物件替换,而不需要更改ON_UPDATE_COMMAND_UI处理程序中的代码。
The following table summarizes the effect CCmdUI’s member functions have on various command user-interface items.
下面的表格总结了CCmdUI的成员函数在不同的命令用户接口项目上所具有的效果
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 |
用户接口项目 | Enable | SetCheck | SetRadio | SetText |
菜单项 | 启用或禁用 | 选取 (×) 或不选 | 使用圆点选取 | 设置项目文本 |
工具栏按钮 | 启用或禁用 | (选择, 未选择或不确定) | 与SetCheck相同 | (不可用) |
状态栏窗格 | 使文本可见或不可见 | 设置弹出或是普通边框 | 与SetCheck相同 | 设置窗格文本 |
CDialogBar中的普通按钮 | 启用或禁用 | 选取或不选复选框 | 与SetCheck相同 | 设置按钮文本 |
CDialogBar中的普通控件 | 启用或禁用 | (不可用) | (不可用) | 设置窗口文本 |
For more on the use of this class, see Constructing the User Interface in Visual C++ Tutorials and How to Update User-Interface Objects in Visual C++ Programmer's Guide.
#include <afxwin.h>
Class Members | Hierarchy Chart
Sample MFC Sample MDI
See Also CCmdTarget