windows programming using mfc and visual c ++ .net

Post on 18-Mar-2016

66 Views

Category:

Documents

9 Downloads

Preview:

Click to see full reader

DESCRIPTION

Windows Programming Using MFC and Visual C ++ .Net. Menus and Tool Bars. Menus. AppWizard creates two menu resources IDR_MAINFRAME The mainFrame menu is displayed when there is no childFrame. IDR_MAINFRAME. Menus. IDR_ " DocType " Type - PowerPoint PPT Presentation

TRANSCRIPT

Masoud MilaniSchool of Computer ScienceFlorida International UniversityMiami, FL 33199 milani@fiu.edu

Windows Programming Using MFC and

Visual C++ .Net

Menus and Tool Bars

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 2

Menus AppWizard creates two menu

resources IDR_MAINFRAME

The mainFrame menu is displayed when there is no childFrame

IDR_MAINFRAME

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 3

Menus IDR_"DocType"Type

The mainFrame menu when there is at least one childFrame

IDR_IntroType

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 4

Menus Menus are

created or modified using the Menu Editor

Menu

resources

Place

holde

r for

new

men

u

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 5

Menus To create a new menu

Type a name in a menu placeholder

Set the menu's properties

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 6

Menus Decide which class must handle this

menu command Document ? View? Mainframe? App? ChildFrame?

Use the class wizard to write a handler for the menu's COMMAND message

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

Menus

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

Menus

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 9

Menu Prompt Menu prompt is the message that

appears inside the status bar when the mouse is on the menu

Menu Prompt

Enter menu's prompt in its property box

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 10

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

of a letter in the menu's captionNew Men&u

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 11

Short Cuts Enter other short

cuts in the Accelerator Table

Place holder for anew accelerator

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 12

Short Cut Properties

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 13

Menu State A menu can be in one of the following

states: Enabled

Enabled(TRUE); Disabled

Enable(FALSE); Checked

SetCheck(TRUE); Unchecked

SetCheck(FALSE);

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 14

Menu State The state of a menu is set in the

handler for the menu UPDATE_COMMAND_UI messagevoid CIntroView::OnUpdateEditNew(CCmdUI* pCmdUI) {

// TODO: Add your command update UI handler code herepCmdUI->SetCheck(TRUE);

}

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 15

Command Routing Menus and Tools bars are a part of the

MainFrame. Who gets the menu commands?

Menu commands are routed to the following objects to a find a event handler View Document ChildFrame MainFrame Application

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 16

ToolBars Similar to Menus Can have the same ID as a menu

item Can have Tool Tip

ToolTip

Introduction to Windows Programming Using MFC and Visual C++ .NetMenus and Tool Bars 17

ToolBars A Toolbar Button's Tool Tip is also

entered in its prompt property box Prompt and Tool Tip strings are

seperated by \n

top related