02-12-2017 04:56 PM - edited 02-12-2017 05:22 PM
Hey Wire Wizards
Im developing an application using the treeview and I'm encountering a behaviour which I find a bit annoying but cant find a workarround.
Essentialy when I right click on an item I want the click to select the item (left click behaviour) and then show its contextual menu ( right click behaviour).
What I'm seeing is that when you right click on an item it shows the contextual menu of the item which is selected, not the item I right click on.
The behaviour I'm after is consistient with the behaviour of windows explorer.
Much appreciated
02-13-2017 09:49 AM
Try XControl to alter the default behavior.
02-13-2017 11:07 AM - edited 02-13-2017 11:07 AM
There are a couple methods to do this. One might be to capture the mouse down? event, then detect what item your mouse is over, and then set the value of that before, processing the menu. Another option might be to use that same Mouse Down? filtering event and change the button clicked to the left mouse button, and then using a system call, invoke a left click. This behavior does kinda suck, and it is a bit weird we need to code this type of functionality.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-13-2017 11:26 PM
Thanks Hooovahh
I was going down the path of calculating which item the mouse is over but kept thinking there must be an easire way, but I think you are right. I'll post a solution if I get it working.
Cheers
02-15-2017 09:22 PM
OK I solved it and solution attached.
I can use the mouse move event to calculate the position over the control and then select the item that the mouse is over, so when I right click the contextual menu for that item can be shown.
Cheers
Kurt
02-16-2017 10:53 AM
1. There is an invoke node to convert coordinate to tag. No need to do the calculation yourself.
2. All you have to do is catch the right button down event. No need to make the VI so busy, and alter the tree value.
I modified the VI.
02-19-2017 11:26 PM
Hey George
Thanks for that, I'm still on 2014 ATM. Could you post an image or LV 2014?
02-20-2017 10:03 AM
I saved the VI to LabVIEW2014.
02-22-2017 06:52 PM
Thanks George
A nice simple solution
Cheers
07-04-2018 03:36 PM
Hi George,
I am trying to do something similar - right to edit a tree item rather than left click.
Could you please save your VI in LabVIEW2013?
Jega