popupMenu

popupMenu(menu: MenuItem;
          x:    Integer;
          y:    Integer);

The popupMenu method of the Form class invokes a popup menu for the form.

The parameters of the popupMenu method are listed in the following table.

Parameter Description
menu An existing popup menu item of the menu of the form
x The left position to display the popup menu
y The top position to display the popup menu

The menu item must be part of the menu of the form and must have subitems. The submenu does not need to be visible in the current form menu. The menu click message is not received until the current window activity is finished (that is, until after the calling methods have exited).

A MenuItem::select event that has the closed parameter set to false is called for the menu referenced by the popupMenu method before the menu is displayed. A select event that has the closed parameter set to true (that is, deselected) for the popup menu is called only when the menu is closed.

The popupMenu method cannot be invoked from a server method.

The popupMenu method can be invoked when the user clicks the right mouse button, as shown in the methods in the following examples.

theTable_mouseDown(table:  Table input;
                   button: Integer;
                   shift:  Integer;
                   x, y:   Real) updating;
// left button  - go into drag mode
// right button - popup menu of table columns
begin
    xColSave := convertPositionToColumn(x);
    yRowSave := convertPositionToRow(y);
    if xColSave <> 0 and yRowSave <> 0 then
        if theTable.row = 1 then
            if button = Window.MouseButton_Left then
                table.dragMode := DragMode_Drag;
            else
                popupMenu(mPopupColumnList, (x + tableGroup.left +
                          table.left).Integer, (y + tableGroup.top +
                          table.top).Integer);
            endif;
        endif;
    endif;
end;

table1_mouseDown(table:         Table input;
                 button, shift: Integer;
                 x, y:          Real) updating;
begin
    if button = Window.MouseButton_Left then
        dragMode := DragMode_Drag;
    else
        popupMenu(menuItemAction, x.Integer, y.Integer);
    endif;
    selectedColumn := table.column;
end;

For more details, see "Windows Events and JADE Events", later in this document.