现在的位置: 首页 > 综合 > 正文

Command Routing Classes – MSDN6翻译交流

2013年09月27日 ⁄ 综合 ⁄ 共 1598字 ⁄ 字号 评论关闭

BUG和建议请提出,谢谢!

Command Routing Classes

命令路由类

As the user interacts with the application by choosing menus or control-bar buttons with the mouse, the application sends messages from the affected user-interface object to an appropriate command-target object. Command-target classes derived from CCmdTarget include CWinApp, CWnd, CDocTemplate, CDocument, CView, and the classes derived from them. The framework supports automatic command routing so that commands can be handled by the most appropriate object currently active in the application.

用户使用鼠标选择菜单或控件栏按钮来与应用交互,应用从被作用的用户接口物件发送消息到适当的command-target(命令目标)物件。命令目标类继承自CCmdTarget,包括CWinApp, CWnd, CDocTemplate, CDocument, CView以及从它们继承的类。The framework(构架)支持自动的命令路由,因此命令能够被应用中当前活动的最合适的物件所操控。

An object of class CCmdUI is passed to your command targets’ update command UI (ON_UPDATE_COMMAND_UI) handlers to allow you to update the state of the user interface for a particular command (for instance, to check or remove the check from menu items). You call member functions of the CCmdUI object to update the state of the UI object. This process is the same whether the UI object associated with a particular command is a menu item or a button or both.

一个CCmdUI类的物件被传送到你的命令目标的update command UI (ON_UPDATE_COMMAND_UI)处理者,(以此)允许你(按照特定的命令)更新用户接口的状态(例如,从菜单项上设置或移除选择标记)。你(可以)调用CCmdUI物件的成员函数来更新UI物件的状态。不管关联某特定命令的UI物件是一个菜单项还是一个按钮或是两者都有,此过程都是相同的。

CCmdTarget

Serves as the base class for all classes of objects that can receive and respond to messages.

用作所有可以接收并响应消息的物件的类的基类。

CCmdUI

Provides a programmatic interface for updating user-interface objects such as menu items or control-bar buttons. The command target object enables, disables, checks, and/or clears the user-interface object via this object.

提供一个(程序化的)接口用于更新像菜单项或是控件栏按钮那样的用户接口物件。命令目标物件通过此物件来启用、禁用、(选取)或是(清除)用户接口物件。

 

抱歉!评论已关闭.