ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Treeview with context menus (https://www.excelbanter.com/excel-programming/429275-treeview-context-menus.html)

Gustaf

Treeview with context menus
 
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

Patrick Molloy

Treeview with context menus
 
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

"Gustaf" wrote in message
...
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




All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com