How can I display a shortcut menu when user right clicks a cell?
If you want to provide different shortcut menus for control depending on clicked cell, the MouseUp or MouseDown events should be used. Else, if you want to provide a general shortcut menu, the RClick event can be used too. The following sample handles the MouseUp event and displays a shortcut menu when user right clicks a cell: Private Sub Tree1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) ‘ Checks whether the user right clicks the mouse If (Button = 2) Then ‘ Gets the cell from point Dim h As HITEM, c As Long, i As Long, hit as Long h = Tree1.ItemFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, c, hit) ‘ Displays a popup menu if the right clicks a cell If (h <> 0) Then i = PopupMenu1.ShowAtCursor() If (i > 0) Then ‘ Displays the identifier of the context menu item selected Debug.Print “You have selected the item ” & i End If End If End If End Sub The sample uses the exPopupMenu that can be downloaded here.