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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Partial Class TESTForm: Prognoz.Platform.Forms.Net.ForeNetForm
    Public Constructor TESTForm();
    Begin
        InitializeComponent();
    End Constructor;
    
    TView: ITabView;

    Private Sub TESTForm_Load(sender: System.Object; e: System.EventArgs);
    Var
        Items: ToolStripItemCollection;
        Item: ToolStripItem;
    Begin
        TView := (reportBoxNet1.CtrlBox.Report.Report.ActiveSheet As IPrxTable).TabSheet.View;
        //Create menu item
        Items := contextMenuStrip1.Items;
        Items.Clear();
        Item := Items.Add("Format");
        Item.Click += toolStripMenuItem1_Click;
        //Set the context menu for the ReportBoxNet component
        reportBoxNet1.ContextMenuStrip := contextMenuStrip1;
    End Sub;

    Private Sub toolStripMenuItem1_Click(sender: System.Object; e: System.EventArgs);
    Begin
        TView.ShowFormatDialogEx(New IWin32WindowForeAdapter(Self));
    End Sub;
End Class;

See also:

IControl