Treeview with context menus

  • Thread starter Thread starter Gustaf
  • Start date Start date
G

Gustaf

Trying to make a form with a TreeView control and context menus. So rather than having buttons for the typical Add, Edit and Remove commands, I'd like to do everything in context menus. Problem #1 is I can't find context menu controls (or any menus!) among Additional Controls in VBA. Problem #2 is that I can't find out how to catch a right mouse click in the TreeView.

Shall I resort to using the TreeView for selecting nodes only and use buttons for the Add, Edit and Remove commands?

Gustaf
 
you can use the mousedown event to check which button was pressed ...


Private Sub TreeView1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As
stdole.OLE_YPOS_PIXELS)

MsgBox "button " & Button

End Sub
 
Back
Top