windows programming using mfc and visual c ++ .net

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

Upload: schuyler

Post on 18-Mar-2016

65 views

Category:

Documents


9 download

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

Page 1: Windows Programming Using MFC and Visual C ++  .Net

Masoud MilaniSchool of Computer ScienceFlorida International UniversityMiami, FL 33199 [email protected]

Windows Programming Using MFC and

Visual C++ .Net

Menus and Tool Bars

Page 2: Windows Programming Using MFC and Visual C ++  .Net

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

Page 3: Windows Programming Using MFC and Visual C ++  .Net

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

Page 4: Windows Programming Using MFC and Visual C ++  .Net

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

Page 5: Windows Programming Using MFC and Visual C ++  .Net

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

Page 6: Windows Programming Using MFC and Visual C ++  .Net

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

Page 7: Windows Programming Using MFC and Visual C ++  .Net

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

Menus

Page 8: Windows Programming Using MFC and Visual C ++  .Net

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

Menus

Page 9: Windows Programming Using MFC and Visual C ++  .Net

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

Page 10: Windows Programming Using MFC and Visual C ++  .Net

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

Page 11: Windows Programming Using MFC and Visual C ++  .Net

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

Page 12: Windows Programming Using MFC and Visual C ++  .Net

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

Short Cut Properties

Page 13: Windows Programming Using MFC and Visual C ++  .Net

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);

Page 14: Windows Programming Using MFC and Visual C ++  .Net

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);

}

Page 15: Windows Programming Using MFC and Visual C ++  .Net

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

Page 16: Windows Programming Using MFC and Visual C ++  .Net

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

Page 17: Windows Programming Using MFC and Visual C ++  .Net

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