04-03-2019 07:36 AM
Hello,
I'm programming a software with LV2016 that uses a XY graph. The user will be able to edit the Plot legend name on the front panel. Then I use the plot names to update page caption in a tab control.
After some tests, I noticed that when the user deletes the plot name via the plot legend, the page caption in the tab control keeps the previous plot name. I try to figure out where the problem comes from and it looks like the graph doesn't reset the plot name when deleting the plot legend name. The only ways I've found to reset/delete the plot name are with the properties of the graph (right click on the XY graph) or by putting an empty string in the property node of the graph, but that's not what i'm looking for.
Of course I could use string controls and put them over each plot legend name but I would like to know if there is a way or a property to correctly delete the plot name by deleting the plot legend name via the front panel.
I put a small exemple that describe my problem.
Thanks in advance !
Solved! Go to Solution.
04-03-2019 07:43 AM
How are you deleting the plot legend name, and it isn't working?
If I select the string in the plot legend, hit delete, and either hit enter or click else where, it seems to update for me.
04-03-2019 08:14 AM - edited 04-03-2019 08:15 AM
Hello RavensFan,
Indeed, it updates in my side too, but sometime it looks like the program doesn't consider the new Legend name when I delete the string and click else where as you can see below :
04-03-2019 08:18 AM
What do you mean by "left else where"?
04-03-2019 08:23 AM
Click* else where sorry
04-03-2019 08:40 AM
Odd. Because I could click elsewhere and it would update.
But to be fair there were a couple times in messing with it that it didn't seem to update. But I could never figure put my finger in exactly what I did that caused it not to update.
04-03-2019 08:57 AM
Little Update : I noticed I've made a small mistake : the event was generated in each loop.
I corrected it but still got the same problem.
04-03-2019 10:38 AM
Why are you playing around with spaces vs. empty strings in the timeout case of the event structure, switching back and forth between them?
I think you might have a race condition game going on where if you delete the string as just the wrong moment, the race between those property nodes where one is switching from a space to an empty string, and the other is switching from an empty string to a space, that although you changed the string, the results of the comparisons aren't recognizing a change occurred.
I ran your code with highlight execution turned on and it helped show me how confusing it all was and the results of the comparison kept coming out to be False and not triggering a change.
(PS: You don't need those constants on the Index array function.
04-05-2019 03:29 AM - edited 04-05-2019 03:29 AM
Indeed I ran my code with highlight execution aswell and I saw that the comparaison doesn't trigger the event.
Furthermore, I noticed that when you delete the plot legend name via the front panel and you try to read the plot name with a property node, the graph keeps in memory its previous plot name, instead of returning an empty string.
I think I'm going to use string controls I'll put on the different plot legend name as follows in this example. It makes the event easier to handle and allows me to write empty string in my plot legend and my tab control.
04-05-2019 06:42 AM
I think that's probably a good idea. Besides what I think may be a race condition in the way you coded it, it is also possible there is a timing issue in the way the event structure handles events. The order of when LabVIEW detects events vs. its handling internally things like the plot legend update or leaving a control maybe in happening in an order that works against you.