Nearly any visual object, with a few exceptions such as images and rectangles, can have a pop-up menu that you activate with the right mouse button. The pop-up menu uses the same syntax as the menu bar, except that you omit the keyword MENUBAR:

DEFINE MENU menu-name

[ { LIKE other-menu } | menu-element-descriptor . . . ].

Pop-up menus can contain menu items, submenus, rules, and skips. However, OpenEdge does not support accelerators for pop-up menu items. If you define them, the AVM ignores them.

To define a pop-up menu in the sample window:

  1. Go into the object’s property sheet and select the Pop-Up Menu button. This brings up the same menu property sheet as before.
  2. Define a pop-up menu for the Order browse and call it m_OrderBrowse.
  3. Define menu items called By OrderNum, By OrderDate, By ShipDate, and By PO.
  4. Following these items, add a RULE.
  5. Add one more item called No ShipDate:
  6. Define a CHOOSE trigger for each item.
    For the first four menu items, you want to sort the Orders by the appropriate field by reopening the Order query with a different BY clause. This is the trigger for m_By_OrderNum:
    DO:
      OPEN QUERY OrderBrowse FOR EACH Order OF Customer
        BY Order.OrderNum.
    END.
  7. Define similar triggers for m_By_OrderDate, m_By_PO, and m_By ShipDate.
  8. For the final item (m_No_ShipDate), you want to filter the query to show only those Orders with no ShipDate:
    DO:
      OPEN QUERY OrderBrowse FOR EACH Order OF Customer
        WHERE Order.ShipDate = ?.
    END.
  9. To try out your new pop-up menu, Run the window and then right-click on the browse to bring up the pop-up: