LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get an event-based response to a graph cursor change?

I want to respond to the user moving a cursor on a data (X-Y) graph. (LV 7.0)

What I really want is an event called "Graph.Cursor.Value Change", which would supply me with the new coordinates, but I see no such event.

If I use the MOUSE MOVE event to trigger obtaining the cursor values, it does not give me an event, until the cursor has stopped moving, the button is up, and the mouse moves off the cursor line.

Sure, I could use a TIMEOUT event, and read it every 100 mSec, but I don't like the time lag.

What I did was to set a flag TRUE on Graph.MouseDown and FALSE on Graph.MouseUp. I then choose an event timeout of 10 mSec or -1, depending on that flag.

That works, but is there a more direct way that I'm missing?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 12
(4,018 Views)
No, unfortunately there is not.

To code around this limitation, I typically use the timeout event in a more complex way as follows:

The timeout is wired to a shift register that is initialized with "-1" (no timeout). The value from the shift register then crosses the event structure and feeds to the shift register on the right in almost all event cases.

I add two special event cases:
(1) "graph-mouse down" puts a small number (e.g. 10ms) in the right timeout shift register
(2) "graph-mouse up" puts again a -1 in the right timeout shift register
(x) All other event cases (incl. timeout) wire the current timeout straight across to the right shift register.

The timeout event contains the logic to read the graph cursors and associated actions.

This way there is normally infinite timeout. Once the mouse goes down on the graph, the timeout executes at relatively rapid succession until the mouse is raised again. At which point everything quiets down.
0 Kudos
Message 2 of 12
(4,011 Views)
Well, that's the same thing, except you use a shift reg, where I used a local boolean. It works OK, it just feels a bit hackish.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 12
(4,003 Views)
So, yes, I am doing basically the same thing, except I handle the timout directly instead of going through a boolean flag. Maybe saves a few electons, but overall "same difference". 😉
0 Kudos
Message 4 of 12
(4,002 Views)
hi

maybe you can write the position of the cursor to the val(signaling) property of a hidden numeric control in the timeout event and then catch the value change event of that hidden control in another case (got no LV right now and never tried that...).

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 12
(3,994 Views)
Well, if I have to use the timeout event to catch a change in the cursor, then I'd sooner use the new value right there. Your scheme would make it truly event-based, but at a cost in complexity. And I would still have to have the timeout stuff.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 12
(3,987 Views)
>If I use the MOUSE MOVE event to trigger obtaining the cursor values, it does not give me an event,
>until the cursor has stopped moving, the button is up, and the mouse moves off the cursor line.


If LabVIEW MOUSE MOVE event doesn't triggered correctly, try use Windows MouseMove event instead.

George Zou
http://gtoolbox.yeah.net
George Zou
0 Kudos
Message 7 of 12
(3,975 Views)
try use Windows MouseMove event instead.

Well, that would mean even more wasted events than a timeout, wouldn't it?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 12
(3,971 Views)
There is no fair comparison between the two events. Timeout event gets triggered even when mouse doesn't move.

George Zou
http://gtoolbox.yeah.net
George Zou
0 Kudos
Message 9 of 12
(3,965 Views)
In any case, I would have to compare the old value and new value myself on each mouse-move event for the whole window, and react if there was a difference. I see that it would work, but it's no more direct than my original idea.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 12
(3,957 Views)