LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse movement

Solved!
Go to solution

Hello,

 

First of all I am novice in programming in LabView.

Can anyone please help me with how can I show mouse movement to graph? It would be like tracking mouse movement and then after cliking button it would show in the graph. I got coords of mouse move using events but now I am strugling with putting it in to graph.

 

I was thinking using arrays and fill them with horizontal and vertical coords but I can't get it working. It would be like:

iteration - horizontal - vertical

1            - 650          - 541

2            - 660          - 530

.....

 

And then use horizontal and vertical as X and Y. Maybe instead of iterations it can be used time of event.

That's one thing I am struggling with.

 

Second thing. It's kind of easier. Program should have 2 options how to stop:

One with button that's I solved.

Second it should stop after 15 seconds of not doing anything (no mouse movement). This is also something that I am struggling with.

0 Kudos
Message 1 of 7
(2,616 Views)

Hi mich,

 


@xMich wrote:

First of all I am novice in programming in LabView.

I got coords of mouse move using events but now I am strugling with putting it in to graph. … but I can't get it working.


So you created a VI with some errors but you can't attach your VI? How should we improve it then?

 

You know the self-paced courses to learn LabVIEW (as a novice!) are free until end of April? Take them!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,603 Views)

Hi xMich, and welcome to the forums!

 

I'm sure there are a number of ways of doing this.  My approach would be be to capture the pane Mouse Move event and store the accumulating coordinates in a shift register.  Then on the button press or timeout, dump the cordinates to an XY graph and reset the shift register.

 

As GerdW said, it's always easier for us to help if you attach your code (LabVIEW 2015 or earlier for me, please).

 

PsyenceFact

0 Kudos
Message 3 of 7
(2,591 Views)

I have attached VI I created. (hopefully)

And I want to have only 1 graph that will have as X and Y horizontal and vertical data of mouse movement.

It should draw a line of where mouse moved on front panel if I am saying that so you can understand.

 

And second thing ending it after 15 seconds of no movement.

 

I will take a look at those courses thank you!

0 Kudos
Message 4 of 7
(2,590 Views)

Thank you for welcoming!

 

I was thinking about something same but I don't know much how to code it right that's why I am asking for help.

 

I will attach you here code for your version 

 

0 Kudos
Message 5 of 7
(2,576 Views)
Solution
Accepted by xMich

Here's something that does what I think you want.

 

On every Mouse Move event the horizontal and vertical coordinates are each added to arrays which are stored in shift registers.  When the Plot button is pressed, the contents of the shift registers are turned in to a format suitable for the XY graph and then plotted.  The axis limits are set to match the pane size, but you could set the axis limits initially and turn autoscale off.

 

The Timeout case runs after the set time if no other events occur.  Here, we just reset the shift registers so start tracking again.

 

Let me know if you have any questions about this.

 

PsyenceFact

Message 6 of 7
(2,542 Views)

Yes this is exactly what I wanted.

 

Thank you so much for help!

You added great notes so there are no questions.

0 Kudos
Message 7 of 7
(2,536 Views)