showContextMenu__

showContextMenu__(menu:   MenuItem;
                  conwin: Window input;
                  mouse:  Boolean; 
                  x:      Integer; 
                  y:      Integer);

The showContextMenu__ method of the Window, ListBox, Table, and JadeEditor classes is a helper method that can be called from contextMenu events to display a menu using the event details. If the event was generated by the mouse, the x and y positions are converted to be relative to the form for the call to Form class popupMenu method. If the event was generated by the use of the keyboard, the required x and y positions will be generated by the method.

The parameters for the showContextMenu__ method are listed in the following table.

Parameter Description
menu The context menu to display. If this parameter is null, no menu is displayed.
conwin

The window being right‑clicked or the control with the focus when the keyboard menu key is pressed.

When the mouse is used, the x and y positions are relative to the start position of this window.

mouse

Contains true if the mouse generated the event or false if the keyboard generated it.

If the mouse parameter is true, the context menu is positioned at the specified x and y positions relative to the window specified in the conwin parameter.

If the mouse parameter is false, for:

  • A ListBox class, the context menu is positioned below the current listIndex entry, or at the top of the list if the listIndex property value is -1 or the item is not visible.

  • A Table class, the context menu is positioned at the current table column and below the current row entry, or at the left if the column is not visible and at the top if the row is not visible.

  • A JadeEditor class, the context menu is positioned on the line below the cursor position if visible, or at <conwin width/3, 5> if the cursor position is not visible.

  • All other windows, the context menu is positioned at <conwin width/3, 5> relative to the conwin parameter.

x

The left position in pixels to display the context menu relative to the window specified in the conwin parameter when the mouse parameter is true, or ignored if the mouse parameter is false.

y

The top position in pixels to display the context menu relative to the window specified in the conwin parameter when the mouse parameter is true, or ignored if the mouse parameter is false.

The following example shows the use of the showContextMenu__ method.

lstCustomers_contextMenu(listbox:ListBox input; conwin: Window input; 
                         mouse: Boolean; x: Integer; y: Integer):Boolean updating;
begin
    listbox.showContextMenu__(mnuEditMenu, conwin, mouse, x, y);
    return false;
end;

2022.0.01 and higher