Windows Programming Using MFC and Visual C Net

  • Slides: 17
Download presentation
Windows Programming Using MFC and Visual C++. Net Menus and Tool Bars Masoud Milani

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

Menus Z App. Wizard creates two menu resources W IDR_MAINFRAME C The main. Frame

Menus Z App. Wizard creates two menu resources W IDR_MAINFRAME C The main. Frame menu is displayed when there is no child. Frame IDR_MAINFRAME Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 2

Menus W IDR_"Doc. Type"Type C The main. Frame menu when there is at least

Menus W IDR_"Doc. Type"Type C The main. Frame menu when there is at least one child. Frame IDR_Intro. Type Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 3

Menus nu Me old h ce nu Pla me w ne fo er r

Menus nu Me old h ce nu Pla me w ne fo er r es rc ou res Z Menus are created or modified using the Menu Editor Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 4

Menus Z To create a new menu W Type a name in a menu

Menus Z To create a new menu W Type a name in a menu place holder W Set the menu's properties Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 5

Menus Z Decide which class must handle this menu command W Document ? W

Menus Z Decide which class must handle this menu command W Document ? W View? W Mainframe? W App? W Child. Frame? Z Use the class wizard to write a handler for the menu's COMMAND message Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 6

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

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

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

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

Menu Prompt Z Menu prompt is the message that appears inside the status bar

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

Short Cuts Z For Alt key short cut, put & in front of a

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

Short Cuts Z Enter other short cuts in the Accelerator Table Place holder for

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

Short Cut Properties Introduction to Windows Programming Using MFC and Visual C ++. Net

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

Menu State Z A menu can be in one of the following states: W

Menu State Z A menu can be in one of the following states: W Enabled C Enabled(TRUE); W Disabled C Enable(FALSE); W Checked C Set. Check(TRUE); W Unchecked C Set. Check(FALSE); Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 13

Menu State Z The state of a menu is set in the handler for

Menu State Z The state of a menu is set in the handler for the menu UPDATE_COMMAND_UI message void CIntro. View: : On. Update. Edit. New(CCmd. UI* p. Cmd. UI) { // TODO: Add your command update UI handler code here p. Cmd. UI->Set. Check(TRUE); } Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 14

Command Routing Z Menus and Tools bars are a part of the Main. Frame.

Command Routing Z Menus and Tools bars are a part of the Main. Frame. Z Who gets the menu commands? W Menu commands are routed to the following objects to a find a event handler C View C Document C Child. Frame C Main. Frame C Application Introduction to Windows Programming Using MFC and Visual C ++. Net Menus and Tool Bars 15

Tool. Bars Z Similar to Menus Z Can have the same ID as a

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

Tool. Bars Z A Toolbar Button's Tool Tip is also entered in its prompt

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