LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect mouse click event?

Hello,

 

I would like to have a vi to detect left, right and no mouse click. I mean that in the vi attached, Button2 should be 0 (no click), 1 (left c.) or 2 (right c.) depending on the event occured in i-1. cycle. My vi is the modyfied version of the one found here:

http://www.ni.com/example/27663/en/

 

Sometimes it works fine, but another time nothing happens when I click.

 

I think the main problem is with the execution times at the for loop and event structure.

 

Could you help me how to deal with the problem?

 

Thanks you!

 

0 Kudos
Message 1 of 3
(2,775 Views)

Hi VampireEmpire,

Your For loop iterates twice. If an event occures during first iteration everything is fine - Button 2 refreshes during second iteration. But what happens when an event occures during second iteration? Does Button 2 have a possibility to refresh? 

 

1. Do you see the problem now?

2. And if you do - do you really need For loop? I would suggest you trying removing it and connecting shift register to the while loop.

 

Bluesheep

 

 

0 Kudos
Message 2 of 3
(2,756 Views)

Hi Bluesheep!

 

Thank you for your fast reply! Now it works fine.

0 Kudos
Message 3 of 3
(2,746 Views)