Download presentation
Presentation is loading. Please wait.
Published byGloria Parrish Modified over 9 years ago
1
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San Diego
2
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Ch5. Menus, Sub Procedures & Sub Functions Menus and submenus Windows common dialog boxes Function procedures Sub procedures Creating Executable Files
3
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Menus Caption: Holds menu "words" Follow naming conventions: –mnu + –mnu + + –E.g., mnuFileExit, mnuEditClear or mnuFile Submenu: menu within a menu
4
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Defining Menus Define menus: Tools, Menu Editor –Caption –Name (mnuMenuxxCommand) Sub menus defined by indenting command Menu and submenu captions use & before keyboard access key
5
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Creating a Menu Create a menu structure like this one: FileHelp Exit About 1.Type caption 2.Type name 3.Indent if necessary 4.Repeat as needed
6
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Coding for Menu Commands Build commands first Then, double click each command to bring up its Click event procedure You can modify menu order or command order by invoking Menu Editor again Checked property: contains check—toggles on and off Enabled property: command available or not based on the Enabled property
7
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Standards for Windows Menus Follow existing Windows standards File menu is leftmost menu in menu bar Help menu is rightmost menu in menu bar Use keyboard access keys; match them to existing ones Use keyboard shortcuts (Ctrl + P for print)
8
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Common Dialog Boxes You can use existing Windows dialog boxes by inserting the common dialog control on your form Common dialog box does: –Open, Font, Color, Save As, and Print If it is not in your toolbox, then execute: –Project, Components, check the Microsoft Common Dialog Control 5.0
9
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Common Dialog Boxes (cont'd) Only need on Common dialog box/form Code determines which of the possible dialog boxes is displayed Use prefix “dlg” for name of control Display dialog box: dlgCommon.ShowColor dlgCommon.ShowFont
10
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill General Procedures General procedures respond when specifically called by other procedures They are not event driven They are used to “package” a commonly used series of instructions Invoke general procedures by calling them Select Tools, Add Procedure to insert one
11
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Functions vs. Sub Procedures Functions vary from sub procedures in one way: they return a value One calls a general procedure by simply writing its name along with any arguments Somewhere in the procedure, you must set the function’s name equal to the value to be returned
12
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Hands-on Programming Example
13
Copyright© 2000 by the McGraw-Hill Companies, Inc.Irwin/McGraw-Hill Creating Executable Files You can convert your applications to executable (.EXE) Execute File, Make... You can select a special icon for your application, insert the company name, etc. via the Options button on the Make EXE File dialog box
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.