MetabaseListView.OnGetItemPopup

Fore Syntax

Sub OnGetItemPopup(Sender: Object; Args: IMetabaseListViewItemPopupEventArgs);

Begin

//set of operators;

End Sub OnGetItemPopup;

Fore.NET Syntax

Sub OnGetItemPopup(sender: System.Object; Args: Prognoz.Platform.Interop.ExtCtrls.MetabaseListViewItemPopupEventArgs);

Begin

//set of operators;

End Sub OnGetItemPopup;

Parameters

Sender. The parameter returning the component that has generated the event.

Args. The parameter allowing to determine event parameters.

Description

The OnGetItemPopup event occurs when the context menu for the component element is calling.

Comments

The element for which the context menu is called is available in the IMetabaseListViewItemPopupEventArgs.Item property. Using the IMetabaseListViewItemPopupEventArgs.PopupMenu property, its own context menu which will be displayed for the element can be determined.

If the IMetabaseListView.EnableSystemPopupMenu property is set to True for the component, then the system context menu is called for elements. In this case, using the IMetabaseListViewItemPopupEventArgs.PopupMenu property, the called system context menu can be replaced.

Example

Executing the example requires a form, a button named Button1 on it, the MetabaseListView component named MetabaseListView1 and two PopupMenu components named PopupMenu1 and PopupMenu2. Connect the Metabase system assembly.

Sub MetabaseListView1OnGetItemPopup(Sender: Object; Args: IMetabaseListViewItemPopupEventArgs);
Var
    MDesc: IMetabaseObjectDescriptor;
Begin
    MDesc := Args.Item.ObjectDescriptor;
    
If MDesc.ClassId = MetabaseObjectClass.KE_CLASS_STDDIM Then
        Args.PopupMenu := PopupMenu1;
    
Elseif MDesc.ClassId = MetabaseObjectClass.KE_CLASS_CLNDIM Then
        Args.PopupMenu := PopupMenu2;
    
End If;
End Sub MetabaseListView1OnGetItemPopup;

While the form is processed, if context menu is called for table and calendar dictionaries, then the menus generated in the PopupMenu1 and PopupMenu2 components will be displayed correspondingly.

See also:

MetabaseListView