On each platform, application menus have an expected arrangement
of commands. For example, a Window menu is typical for Windows applications but
that menu is not expected on other platforms. As you plan your menus,
keep in mind what your users expect to see.
In particular, avoid assigning shortcut keys to menu items
when users are accustomed to using that same shortcut key for standard
actions, such as saving, closing a window, or ending the application.
In addition to platform differences, keep in mind the various
models of computers and keyboards that your users have.
Shortcut keys or accelerator keys
You can specify two types of keyboard equivalents for menu
keys are key combinations that you can define in the menu painter
to provide direct access to a menu item. For example, in many applications, ctrl+q is
a shortcut for Exit or Quit. In Motif, they are called accelerator
- Accelerator keys are underlined letters in menu names and menu items that the
user can press in combination with another key to access the item. In
Motif, they are called mnemonics.
Modifier keys for shortcut keys
The Menu painter shows the available modifier keys for menu
shortcut keys. When
two commands have the same shortcut, PowerBuilder executes the menu item
that occurs later in the menu hierarchy.
Accelerator keys are underlined characters in an item’s
name or label that the user can press to select the item. On Windows,
the user presses the alt key and an underlined
accelerator key in the menu bar to drop down a menu. To select an
item on the menu, the user presses the underlined key. For example,
this key sequence drops down the File menu and selects the New menu
item: alt+f n.
In PowerBuilder for UNIX, an accelerator key behaves like a
UNIX mnemonic key. The user accesses the underlined key by pressing
the meta key, which may or may not be defined
as the alt key.
When you name a menu item, you can designate an accelerator
key by typing an ampersand before the desired character.
Changing the itemnames on dropdown menus
On different platforms, users may expect different names for
similar menu commands. For example, users typically expect either
a Quit or an Exit command on their File menu. To meet your users’ expectations
on all platforms, you can set the menu type property for the Exit
You cannot change the menu’s shortcut keys You cannot change the shortcut key associated with a menu
item programmatically. You can only specify shortcuts in the Menu
painter. If you don’t want a shortcut to appear on a particular
platform, don’t specify any shortcut for the menu item.
Using inheritance to create platform-specific
If each platform’s menu design needs to be unique,
you could start with an ancestor menu that includes all the commands
that the platforms have in common. Then you could inherit and customize
a descendant for a particular platform, changing menu item names
and shortcut keys and adding new menu items. In the window’s
Open script, you could call the ChangeMenu function and select a
menu based on the OSType specified in the Environment object.
Printer Setup item
On UNIX systems, printer orientation can only be set manually
in the Printer Setup window. To enable users to print DataWindows
whose print specification for paper orientation is set to landscape,
include a Printer Setup item in the application’s File
menu. The clicked script for this menu item should call the PowerScript