LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control cursor in two ways synchronously?

I have a cursor in a graph, i want to control it in two ways, move it in the graph and use a control to change its coordinate. I want to achieve that when i move the cursor with the mouse, the value of the control change with it, and when i change the value, the cursor move.
How can I achieve it? Thank you.
0 Kudos
Message 1 of 9
(3,558 Views)
If you have LV8, it has a really neat event case for Cursor Move.  Have two cases in your event structure: One for cursor moves which takes the value from CursLoc and feeds it to a local variable* for a Cursor Location cluster.    A second event will handle value changes in the cluster; putting the cluster value into a property node for the waveform.

Attached is a simple example.


*Personally, I consider the above one of the few legitimate uses of a local variable.  Even so, there is little protection from race conditions and unexpected results are still possible.  If anyone knows of a more streamlined solution, let me know.

Message Edited by jasonhill on 06-28-2006 10:43 AM

Message 2 of 9
(3,551 Views)
Thank you. But your vi is written in LV 8.0. Mine is 7.1:( Can you help me to change it to 7.1?
Thank you .
0 Kudos
Message 3 of 9
(3,538 Views)

Hi Jason

Thats a realy good solution, I'm going to use that to simplify a program I did last year.

Now for the bad news, I clicked on the wrong end of the stars and gave you  one Smiley Sadwhen I really wanted to give you 5 Smiley Very Happy

Ian

0 Kudos
Message 4 of 9
(3,528 Views)
Jason, 5 stars from me, although I did not look at your vi. I quite sure it's a good solution ;).
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 9
(3,521 Views)
The Cursor Move event is not availible in 7.1 Robot Sad  There may be another solution, using a combination of Mouse Down, Mouse Move, and Mouse Up.  But it is not a simple to implement and I will need to think on it for a bit. 
0 Kudos
Message 6 of 9
(3,512 Views)
Hey Ian,

I have done that too in my time.  It is a shame there is not a limited time edit your rating, the way there is limited time to edit posts.  It would allow the correction of bone-head mistakes while limiting abuse.
Message 7 of 9
(3,508 Views)
Doh!  It seems that I have been using LV8 too much lately.  I had forgoten how nice the cursor legend used to be.  Right click on the graph and select "Properties" and check "Show cursor legend".  It will update the cursor location live as you drag it around and it responds as expected when you type in your own values.  If you need the cursor values elsewhere in your program, use a property node (Cursor List works great if you have more than one cursor you want to track).

An aside about the redesign of the cursor legend between 7.1 and 8.0:  Even after using 8.0 pretty much exclusively since it was released, I still find the older cursor legend more intuitive and more likely to give me the results I want.
Message 8 of 9
(3,506 Views)
Thank you very very much.
I really want to realize the function of the cursor legend.but i don't like the complex surface which can change the colour of the cursor. I only need to have a simple control to realize the function which the cursor legend do.
Can it come true easily?
Thank you.
0 Kudos
Message 9 of 9
(3,493 Views)