Menus and Menu Items

Menus are lists of related commands or options that a user can select in the currently active window. Each choice in a menu is called a menu item.

Usually, all windows in an application have menus except child and response windows.

Menu items appear in a menu bar or in drop-down or cascading menus. Each item in a menu is defined as a Menu object in PowerBuilder.

Using menus

You can use menus in two ways:
  • In the menu bar of windows - Menu bar menus are associated with a window in the Window painter and appear whenever the window is opened.
  • As pop-up menus - Pop-up menus appear only when a script executes the PopMenu function.

Designing menus

PowerBuilder gives you complete freedom in designing menus, however, Sybase recommends that you follow conventions to make your applications easy to use. For example, keep menus simple and consistent; group related items in a drop-down menu; make sparing use of cascading menus, and restrict them to one or two levels.

A full discussion of menu design is beyond the scope of this documentation. Acquire information that specifically addresses design guidelines for graphical applications and apply those guidelines when you use PowerBuilder to create your menus.

Building menus

When you build a menu, you:
  • Specify the appearance of the menu items by setting their properties.
  • Build scripts that determine how to respond to events in the menu items. To support these scripts, you can declare functions, structures, and variables for the menu.
There are two ways to build a menu. You can:
  • Build a new menu from scratch. See Building a New Menu.
  • Build a menu that inherits its style, functions, structures, variables, and scripts from an existing menu, thereby saving yourself coding and time. See Using Inheritance to Build a Menu.
Related concepts
Building a New Menu in PowerBuilder .NET
Related tasks
Using Inheritance to Build a Menu