LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I detect a plot name change event in a plot legend?

Solved!
Go to solution

I'd like to update a configuration file if a user changes the name of a plot in the plot legend.

 

The events I see for plots are:  value change, autoscale range change, plot attribute change, and scale range change.

 

Plot attribute change does not seem to include anything that looks like plot name, and the others obviously don't contain that info either.

 

Is there any way to grab this event?

 

Thanks.

0 Kudos
Message 1 of 8
(3,653 Views)

Hi  jordanglassman,

 

I do not have any solution for you, but I am interested, where can I found the events you mentioned in your post, please?

 

Thank you!

0 Kudos
Message 2 of 8
(3,595 Views)

Check out the Edit Events dialog:

 

events.PNG

Message 3 of 8
(3,587 Views)
Solution
Accepted by topic author jordanglassman

Jordan,

First off, remember that there is no single way to code anything, so I can offer one possible solution for you, but it is definitely not the only one.

 

LabVIEW does not have a property to check if the name has been changed through an event structure, but you can create your own events that LabVIEW can read. I found this really good document that might help you. Read through this and mess around with it and see if it gets you anywhere: Creating User Events

Once you get it to trigger the proper case, then its just getting that case to update the file you would like.

Another possible workaround, although not ideal, is to create a string control and have that be on top of the plot name. You would be able to then produce an event from that string changing value.

Hope this helps.

Douglas Choisnet
Message 4 of 8
(3,567 Views)

Hi Douglas, thanks.

 

I'm familiar with user events, but I would still need to detect the user action somehow.  In this picture, I have edited the top plot label while the VI is running.  How do I alert my app that this has happened?

 

edited.PNG

0 Kudos
Message 5 of 8
(3,563 Views)

Jordan,

You can store the plot name into a shift register of your loop, then compare the value in the shift register with the value in the plot name. This will effectively compare the name of the plot from the previous iteration to the name of the plot in the current iteration. If these are different, the name has changed and you can have your program work appropriately from there.

So you'll need to implement a shift register, equals comparison, a couple name references, etc.

Douglas Choisnet
0 Kudos
Message 6 of 8
(3,559 Views)

OK, so if polling is the answer, then dynamic events are not really needed.

 

To NI devs, consider handling this event.  Thanks!

0 Kudos
Message 7 of 8
(3,551 Views)

The plot legend is an array of clusters (one array element per plot):  Each cluster contains three elements: a string, and two booleans.  The string is the name of the plot.

There appears to be no programatic way to get a reference to that string (from which it might have been possible to register an event).

Your best bet is to trap keyboard and mouse events, and from there check of the plot name has changed.

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 8 of 8
(3,543 Views)