Programming with Microsoft Visual C++.NET 6ed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming with Microsoft Visual C++.NET 6ed [Electronic resources] - نسخه متنی

George Shepherd, David Kruglinski

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید








The Application Framework's Built-in Menu Commands


You don't have to start each frame menu from scratch—the MFC library defines some useful menu commands for you, along with all the command handler functions, as shown in Figure 12-3.


Figure 12-3: The standard SDI frame menus.

The menu commands and command message handlers that you get depend on the options you select in the MFC Application Wizard. If you deselect Printing And Print Preview, for example, the Print and Print Preview commands won't appear. Because printing is optional, the message map entries are not defined in the CView class but are generated in your derived view class. That's why entries such as the following are defined in the CMyView class instead of in the CView class:

ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)


Enabling and Disabling Menu Commands


The application framework can disable a menu command if it does not find a command message handler in the current command route. This feature saves you the trouble of having to write ON_UPDATE_COMMAND_UI handlers. You can disable the feature if you set the CFrameWnd data member m_bAutoMenuEnable to FALSE.

Suppose you have two views for one document but only the first view class has a message handler for the IDM_ZOOM command. The Zoom command on the frame menu will be enabled only when the first view is active. Or consider the Edit Cut, Copy, and Paste commands, which are supplied with the application framework. These will be disabled if you haven't provided message handlers in your derived view or document class.



/ 319