I used Ctrl+F to add or remove items on the Favorite Menu utilizing the Selected/Highlighted node from the ActiveX TreeView Control (MSComctlLib.TreeCtrl.2) as when I look for a right-click event back then, I cannot find one. And I do not want to waste my time on finding that missing Right-Click event as all I wanted is a quick fix for my need.
However, said approach lacks appeal so I said to myself today as I am a bit free to do an experiment, I will try to make that Right-Click function. And it appears it is very easy enough to achieve that. The right-click can be done on MouseDown event using the first parameter button.
When you left click on the treeview, the button parameter receives a value of 1 and when your right-click, it receives 2, while a click on the mouse scroll wheel triggers a value of 4. So a simple IF condition was able to produce what I need with something like this:
MouseDown Event
*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y
IF button = 2
PopFave(this.selectedItem.Text)
ENDIFAnd there you have it, just in case you are wondering how to trigger a right-click as well on your treeview control. Cheers!
No comments:
Post a Comment