DIAdemヘルプ

Object: MenuPoint

  • 更新日2024-09-12
  • 6分で読める

Object: MenuPoint

The MenuPoint object provides an item in the context menu.

Note  To test the following example script, you must first save the script and register the script as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example executes the MyNavigatorOnShowingContextMenu user command when you open the context menu in DIAdem NAVIGATOR and the MyViewOnShowingContextMenu user command when you open the context menu in DIAdem VIEW. These user commands add a new entry to the existing context menus when you open the context menu in the browser, the search results list, the axis system, or the channel table.
When you click one of the defined context menu items, the example executes the MyNavigatorOnContextMenuPointSelected user command or the MyViewOnContextMenuPointSelected user command and displays the selected item in a message.

' --- For DIAdem-NAVIGATOR ------------------------------------------
Call AddUserCommandToEvent("Navigator.Events.OnShowingContextMenu","MyNavigatorOnShowingContextMenu")
Call AddUserCommandToEvent("Navigator.Events.OnContextMenuPointSelected","MyNavigatorOnContextMenuPointSelected")

Sub MyNavigatorOnShowingContextMenu(ParentObj, MenuPoints)
  If (ParentObj.IsKindOf("Browser")) Then
    Call MenuPoints.Add("My Browser Menu Point", 1)
  End If
  If (ParentObj.IsKindOf("ResultsList")) Then
    Call MenuPoints.Add("My ResultsList Menu Point", 2)
  End If
End Sub

Sub MyNavigatorOnContextMenuPointSelected(ParentObj, MenuPoint)
  Select Case MenuPoint.ID
    Case 1    Call MsgBoxDisp("DIAdem-NAVIGATOR: MyMenuPoint1 selected")
    Case 2    Call MsgBoxDisp("DIAdem-NAVIGATOR: MyMenuPoint2 selected")
  End Select
End Sub


' --- For DIAdem-VIEW -----------------------------------------------
Call AddUserCommandToEvent("View.Events.OnShowingContextMenu","MyViewOnShowingContextMenu")
Call AddUserCommandToEvent("View.Events.OnContextMenuPointSelected","MyViewOnContextMenuPointSelected")

Sub MyViewOnShowingContextMenu(Area, MenuPoints)
  If (Area.DisplayObjType = "CurveChart2D") Then
    Call MenuPoints.Add("My CurveChart Menu Point", 1)
  End If
  If (Area.DisplayObjType = "ChannelTable") Then
    Call MenuPoints.Add("My ChannelTable Menu Point", 2)
  End If
End Sub

Sub MyViewOnContextMenuPointSelected(Area, MenuPoint)
  Select Case MenuPoint.ID
    Case 1    Call MsgBoxDisp("DIAdem-VIEW: MyMenuPoint1 selected")
    Case 2    Call MsgBoxDisp("DIAdem-VIEW: MyMenuPoint2 selected")
  End Select
End Sub

Properties

Check | Enable | ID | MenuPoints | Tag | Text

Returned From

MenuPoints.Add | MenuPoints.Item

See Also

Objects Overview