Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Introduction to PowerBuilder

HomePrevious Lesson: Types of menus
Next Lesson: Summary

Menu Properties

In this section you will learn about the menu properties that are used while painting menu.

Menu Item Name Property

As explained in the Window painter, the name of any control is for programming and not for display purpose. As you type the text for the menu bar /menu items, PowerBuilder automatically assigns the name. It assigns a prefix "m_" for each menu bar/menu item name. PowerBuilder automatically strips out any spaces that you have included in the text and limits the length of the NAME to 40 characters. There is a 64 characters limitation on the menu item TEXT.

Locking the Name

As explained above, PowerBuilder automatically assigns the name. Once you leave a menu item in which you are typing the text and come back later and change the text, the name is not changed, since it is locked.

To change the name, you need to de-select the Lock Name check box. The benefit of locking a menu item name is that, any references to it in the application is still valid even after text change.

Microhelp Property

When using MDI windows, you can specify the help text that is to be displayed on the status bar by typing in the Microhelp property. Enter text for each menu item so that it will be displayed when the menu item is selected.

The advantage of Microhelp over PowerTip is that Microhelp appears on the status bar no matter how the functionality to which it is attached to is invoked (by a mouse or a keyboard). The PowerTips are restricted to appear only when the mouse pointer comes to rest over the appropriate icon.

Options under in the Stylebar tab are advanced at this stage and will be explained in later sessions. We will explain Shift Over/Down in the "Menu Inheritance" session and Menu Merge Option & Type Option in the "OLE" session.

Assigning an Accelerator Key

An accelerator key is the underlined letter in the text of a menu item or a window object. User can access the menu items or objects using the keyboard instead of using the mouse by pressing the specified key along with the Alt key. A well designed application should make use of this feature. Offering full keyboard compatibility is a must for all professional applications.

An ampersand character (&) is placed in front of the letter to be used as an accelerator key. For example, the accelerator key for the File menu bar item is F, so you need to type '&File' for that. If you need to display ampersand character in the menu bar/item text, provide two ampersands. For example, to display 'Print in Black & White', you need to type 'Print in Black && White'.

Assigning a Shortcut Key

A shortcut key is a single key or a combination of keys that can be used for selecting a menu item directly, without having to first open the relevant menu bar item. If you look at the Exit option on the File menu item, you can see that Alt+F4 has been added to it as a shortcut key:

Click on the Shortcut tab page. A full list of available shortcut keys includes all the function keys, letters of the alphabet and the specialized Ins and Del keys. They can be used in conjunction with any combination of the Alt, Ctrl and Shift keys.

Note that for the highlighted menu item, selected shortcut keys are displayed in the box next to the menu item text.

Specifying ToolbarIcon Text & PowerTip

When the ShowText option is set to true for the toolbar, PowerBuilder displays the text for the toolbar icon. You can specify the text to be displayed by typing in the Text prompt under the Toolbar tab page. The same text is used for PowerTip also.

Specifying Space Before Toolbar Icon

You can specify the space you want to keep before the toolbar icon in the toolbar. The space is measured in PowerBuilder Units.

Specifying Toolbar Icon Order

You can specify the order in which the toolbar icons are to be displayed. By default, PowerBuilder displays icons from top to bottom for each menu bar item starting from the left.

Other Options

There are two options available for Object Type property. They are Menu and MenuCascade. The default is the Menu. When this option is set, toolbar icons display in the regular mode. If you want to define DropDown toolbars, you need to set this option to MenuCascade. When set, PowerBuilder allows you to change Columns and DropDown options.

Assigning an Icon to the Menu Item

Similar to the icons on a Powerbar/Painterbar, you can assign an icon for each menu option. To assign a toolbar icon, click on the Picture tab page and you can either:
select from the stock of icons provided by PowerBuilder.
You can find some good icons from one of the example applications also.
If you have Art Gallery installed, you can find hundreds of bitmap files in that directory.
specify a custom icon by clicking on Browse button.

PowerBuilder ships several Stock Pictures and there are also various picture files which are used in the example applications. If you create your own icons, you should ensure that they are 16x16 or 32x32 pixels so that they are displayed properly. PowerBuilder displays the icon you specified in the above steps, as long as the menu is visible. Sometimes you may want to display a different toolbar icon whenever the toolbar icon is down (i.e. user pressed the icon). You can do so by providing a name for the Down Picture Name prompt.

The selection of the icons can be crucial. A user should be able to identify the action an icon represents by the picture displayed on it.

Dividing menu items into logical groups

You can divide a menu group into logical sections using separator lines. For example, under a File menu bar item, you can group all the print options together, all the Save options together and so on.

To specify a separator line, you simply supply a single hyphen as the menu item text. PowerBuilder automatically replicates the hyphen to the length of the longest menu option under that menubar item. PowerBuilder will automatically give the separator line a name, like any other menu item, with an identification number. However, if you are trying to paint more than one separator line in a menu, PowerBuilder prompts you for a menu item name for the separator line, instead of assigning the name.

Previewing a Menu

Select Design/Preview option from the menu to simulate the run-time conditions and check if the structure is correct. At previewing time, Power Builder will not show you Microhelp and PowerTips since menus are being previewed and not being executed.
HomePrevious Lesson: Types of menus
Next Lesson: Summary

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com