Presentation is loading. Please wait.

Presentation is loading. Please wait.

Masoud Milani School of Computer Science Florida International University Miami, FL Windows Programming Using MFC and.

Similar presentations


Presentation on theme: "Masoud Milani School of Computer Science Florida International University Miami, FL Windows Programming Using MFC and."— Presentation transcript:

1 Masoud Milani School of Computer Science Florida International University Miami, FL 33199milani@fiu.edumilani@fiu.edu Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars

2 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 2 Menus ZAppWizard creates two menu resources WIDR_MAINFRAME CThe mainFrame menu is displayed when there is no childFrame IDR_MAINFRAME

3 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 3 Menus WIDR_"DocType"Type CThe mainFrame menu when there is at least one childFrame IDR_IntroType

4 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 4 Menus ZMenus are created or modified using the Menu Editor Menu resources Place holder for new menu

5 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 5 Menus ZTo create a new menu WType a name in a menu place holder WSet the menu's properties

6 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 6 Menus ZDecide which class must handle this menu command WDocument ? WView? WMainframe? WApp? WChildFrame? ZUse the class wizard to write a handler for the menu's COMMAND message

7 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 7 Menus

8 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 8 Menus

9 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 9 Menu Prompt ZMenu prompt is the message that appears inside the status bar when the mouse is on the menu Menu Prompt ZEnter menu's prompt in its property box

10 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 10 Short Cuts ZFor Alt key short cut, put & in front of a letter in the menu's caption New Men&u

11 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 11 Short Cuts ZEnter other short cuts in the Accelerator Table Place holder for a new accelerator

12 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 12 Short Cut Properties

13 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 13 Menu State ZA menu can be in one of the following states: WEnabled CEnabled(TRUE); WDisabled CEnable(FALSE); WChecked CSetCheck(TRUE); WUnchecked CSetCheck(FALSE);

14 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 14 Menu State ZThe state of a menu is set in the handler for the menu UPDATE_COMMAND_UI message void CIntroView::OnUpdateEditNew(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here pCmdUI->SetCheck(TRUE); }

15 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 15 Command Routing ZMenus and Tools bars are a part of the MainFrame. ZWho gets the menu commands? WMenu commands are routed to the following objects to a find a event handler CView CDocument CChildFrame CMainFrame CApplication

16 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 16 ToolBars ZSimilar to Menus ZCan have the same ID as a menu item ZCan have Tool Tip Tool Tip

17 Introduction to Windows Programming Using MFC and Visual C ++.Net Menus and Tool Bars 17 ToolBars ZA Toolbar Button's Tool Tip is also entered in its prompt property box ZPrompt and Tool Tip strings are seperated by \n


Download ppt "Masoud Milani School of Computer Science Florida International University Miami, FL Windows Programming Using MFC and."

Similar presentations


Ads by Google