IControl.PopupMenu

Syntax

PopupMenu: IPopupMenu;

Description

The PopupMenu property determines the context menu that opens when the component is clicked with the right mouse button.

Comments

If the component implementation supposes any system context menu, on setting the value in the PopupMenu property the context menu will be replaced with the proper context menu.

In the list of available values the PopupMenu components, which are added to the form or created dynamically in the application code, are included.

Example

Executing the example requires a form with the PopupMenu component named PopupMenu1, ReportBox named ReportBox1 and the UiReport component named UiReport1. UiReport1 is a data source for ReportBox1.

Class TESTForm: Form
    PopupMenu1: PopupMenu;
    UiReport1: UiReport;
    ReportBox1: ReportBox;
    TView: ITabView;

    Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
    Var
        Items: IMenuItems;
        Item: MenuItem;
    Begin
        TView := (ReportBox1.Report.Report.ActiveSheet As IPrxTable).TabSheet.View;
        //Create menu item
        Items := PopupMenu1.Items;
        Items.Clear;
        Item := New MenuItem.Create;
        Item.Text := "Format";
        Item.OnClick := MenuItem1OnClick;
        Items.Add(Item);
        //Determine context menu for the ReportBox component
        ReportBox1.PopupMenu := PopupMenu1;
    End Sub TESTFormOnCreate;

    Sub MenuItem1OnClick(Sender: Object; Args: IEventArgs);
    Begin
        TView.ShowFormatDialogEx(Self As IWin32Window);
    End Sub MenuItem1OnClick;
End Class TESTForm;

On executing the example the context menu will be set for the ReportBox1 component, which will be available in the reports sheet area. The only one item will be available in the menu that is Format. On selecting the item the format window for the current selected cell array will open.

See also:

IControl