1 / 13

prepared by James T. Perry University of San Diego

prepared by James T. Perry University of San Diego. Ch5. Menus, Sub Procedures & Sub Functions. Menus and submenus Windows common dialog boxes Function procedures Sub procedures Creating Executable Files. Menus . Caption: Holds menu "words" Follow naming conventions: mnu + <menu name>

bette
Download Presentation

prepared by James T. Perry University of San Diego

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. prepared by James T. Perry University of San Diego

  2. Ch5. Menus, Sub Procedures & Sub Functions • Menus and submenus • Windows common dialog boxes • Function procedures • Sub procedures • Creating Executable Files

  3. Menus • Caption: Holds menu "words" • Follow naming conventions: • mnu + <menu name> • mnu + <menu name> + <command name> • E.g., mnuFileExit, mnuEditClear or mnuFile • Submenu: menu within a menu

  4. 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. Creating a Menu • Create a menu structure like this one: File Help Exit About 1. Type caption 2. Type name 3. Indent if necessary 4. Repeat as needed

  6. 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. 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. Common Dialog Boxes • You can use existing Windows dialog boxes by inserting the common dialogcontrol 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. 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. 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. 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. Hands-on Programming Example

  13. 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

More Related