DIAdem-Hilfe

Method: Remove for MenuPoints

  • Aktualisiert2024-09-12
  • 2 Minute(n) Lesezeit

Method: Remove for MenuPoints

Removes an item from the context menu.

Object.Remove(Index)
ObjectMenuPoints
Object with this method
IndexLongInteger
Specifies the index of the context menu item that DIAdem deletes.
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 deletes all the items from the context menu. The example adds three new items to the context menu and then deletes the item MyMenuPoint3. If you click a context menu item, a message displays:

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

Sub MyNavigatorOnShowingContextMenu(ParentObj, MenuPoints)
  Call MenuPoints.RemoveAll
  Call MenuPoints.Add("MyMenuPoint1", 1)
  Call MenuPoints.Add("MyMenuPoint2", 2)
  Call MenuPoints.Add("MyMenuPoint3", 3)
  Call MenuPoints.Remove(3)
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)
  Call MenuPoints.RemoveAll
  Call MenuPoints.Add("MyMenuPoint1", 1)
  Call MenuPoints.Add("MyMenuPoint2", 2)
  Call MenuPoints.Add("MyMenuPoint3", 3)
  Call MenuPoints.Remove(3)
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

See Also

Objects Overview