Using the inherited information

When you build and save a menu, PowerBuilder treats the menu as a unit that includes:

  • All menu items and their scripts

  • Any variables, functions, and structures declared for the menu

  • When you use inheritance to build a menu, everything in the ancestor menu is inherited in all of its descendants.

What you can do

You can do the following in a descendant menu:

  • Add menu items to the end of a menu

  • Insert menu items in a menu (with some restrictions)

    For more information, see Where you can insert menu items in a descendant menu.

  • Modify existing menu items

    For example, you can change the text displayed for a menu item or change its initial appearance, such as making it disabled or invisible.

  • Build scripts for menu items that do not have scripts in the ancestor menu

  • Extend or override inherited scripts

  • Declare functions, structures, and variables for the menu

What you cannot do

You cannot do the following in a descendant menu:

  • Change the order of inherited menu items

  • Delete an inherited menu item

  • Insert menu items between inherited menu items that do not have the ShiftToRight property set (see Modifying the ShiftToRight property)

  • Change the name of an inherited menu item

  • Change the type of an inherited menu item

Hiding a menu item

If you do not need a menu item in a descendant menu, you can hide it by clearing the visible property in the Properties view or by using the Hide function.

About menu item names in a descendant

PowerBuilder uses the following syntax to show names of inherited menu items:

AncestorMenuName::MenuItemName

For example, in a menu inherited from m_update_file, you see m_update_file::m_file for the m_file menu item, which is defined in m_update_file.

The inherited menu item name is also locked, so you cannot change it.

Understanding inheritance

The issues concerning inheritance with menus are similar to the issues concerning inheritance with windows and user objects. For information, see Understanding Inheritance.