LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
wiebe@CARYA

disable legend labels option

Status: Completed

Available in LabVIEW NXG 1.0. When a GVI is running, plot labels cannot be manually edited by the user.

I keep thinking that I'm missing something here. I hope there is not a simple property for this that I overloked. Or I do hope there is, but I will feel stupid.

 

When my program displays tags in a graph, how come a user can change the plot legend names? It could be usefull, but 50% of the time it's not. Why can't I disable them easilly? It should be a right click option of the legend, or at least a property of the legend.

 

Now I have to block it with some decoration, and after every resize i have to reposition it. That's not that easy, since the exact location of the legend labels can't be read.

 

Before.jpg

After.jpg

 

17 Comments
wiebe@CARYA
Knight of NI

Spoiler alert: here is the one way I found to do it:

 

Catch the key down event of the graph.

Cast the focus object to string.

If it is a string, read the label of it.

If this gives an error 1320, disable the focus object.

 

If this is done once, the label will be disabled. You can put this in a sub VI, and run the sub vi once. Click the label once, and remove the code. Now the labels will be disabled forever, and no one will ever know how you did it because you deleted the vi.

tomlawton
Member

Oooh, that's evil...! 

crossrulz
Knight of NI

Yes, we need a simple way to keep the users from changing the plot names in the legend during runtime.  I still want to be able to manipulate the names with property nodes during run time.  Just don't want the user to change them.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
wiebe@CARYA
Knight of NI

>Oooh, that's evil...!

 

The problem, or the workaround or both? I'd say both.

wiebe@CARYA
Knight of NI

I was slightly off. It's worse (even less obvious to spot).

 

The key down event will not be triggered when the user edits a label!

 

You need to catch the VI's Key down event. This event will be triggered.

 

Catch the key down event of the VI.

*Check if it's the graph. Get the Owner of the reference recursivelly until reaching control level

Cast the focus object to string.

*If it is a string, read the label of it.

*If this gives an error 1320, disable the focus object.

 

* can be dismissed if you are doing this just once, with the only purpose of disabling labels. If you key down something else, it might be disabled.

 

X.
Trusted Enthusiast
Trusted Enthusiast

Care to post the subVI that does the trick? I am not sure I follow the sequence of action needed.

wiebe@CARYA
Knight of NI

I've prepared a VI. It's been a while since I've used this forum. How can you post a VI?

Darren
Proven Zealot
Status changed to: In Development
 
wiebe@CARYA
Knight of NI

It is in fact done. But how to post it?

Darren
Proven Zealot

I recommend creating a document under your NI Community account, then linking to that here. Select New > Document at the top of the page.