Type | Description | |||
Long | A Long expression that determines the identifier of the command to be executed. |
The following sample shows how you can append new items to the object's context menu and displays a message when a command is selected from the context menu:
Private Sub CascadeTree1_StateChange(ByVal State As EXCASCADETREELibCtl.StateChangeEnum) With CascadeTree1 If (State = ShowContextMenu) Then .ShowContextMenu = .ShowContextMenu + ",Item 1[id=1][def],Popup[id=2](Sub-Item 2[id=2],[sep],Sub-Item 3[id=3])" Else If (State = ExecuteContextMenu) Then Debug.Print "You selected the command: " & .ExecuteContextMenu End If End If End With End Sub
The following sample shows how you can prevent executing a specific command:
Private Sub CascadeTree1_StateChange(ByVal State As EXCASCADETREELibCtl.StateChangeEnum) With CascadeTree1 If (State = ExecuteContextMenu) Then If Not (.ExecuteContextMenu = 17) Then ' Delete Debug.Print "You selected the command: " & .ExecuteContextMenu Else .ExecuteContextMenu = 0 MsgBox "Delete is disabled." End If End If End With End Sub