LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Treeview Control Right Click Behavior

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

0 Kudos
Message 1 of 10
(3,706 Views)

Try XControl to alter the default behavior.

 

George Zou
0 Kudos
Message 2 of 10
(3,636 Views)

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.

Message 3 of 10
(3,628 Views)

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

0 Kudos
Message 4 of 10
(3,610 Views)

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

0 Kudos
Message 5 of 10
(3,599 Views)

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.

 

 

George Zou
Message 6 of 10
(3,586 Views)

Hey George

 

Thanks for that, I'm still on 2014 ATM. Could you post an image or LV 2014?

0 Kudos
Message 7 of 10
(3,559 Views)

I saved the VI to LabVIEW2014.

 

George Zou
Message 8 of 10
(3,547 Views)

Thanks George

 

A nice simple solution

 

Cheers

0 Kudos
Message 9 of 10
(3,528 Views)

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

0 Kudos
Message 10 of 10
(2,939 Views)