Showing results for 
Search instead for 
Did you mean: 

How can I determine programmatically which plot the cursor is snapped to?

Well, when you started talking about "back and forth" and "sophisticated" like it would be difficult to do what I was doing, I assumed you were relatively unfamiliar with the event structure, which makes it pretty now I'm really confused...


I've posted a few times, but it seems they always want a new alias.  But I'm pretty good at finding solutions on my own, though LabVIEW does still throw me a curve every now and then.  Most recently I've had to jump from v7.1 to v8.6, so I'm still discovering some things--like where the hell did they move the color box constant!?  It used to be in the numerics palette.  It's not that big a deal (I can just paste it from some old code), but I'm an old dog and new tricks don't come easy. :smileyvery-happy:


Thanks for your interest, Ravens Fan.


0 Kudos
Message 11 of 15

Hi aliasThree,


You can find the Color Box Constant in the Graphics & Sound»Picture Functions palette.


Also, for the future in LabVIEW 8.6 you can use the Quick Drop feature (similar to the Search box) by pressing CTRL+Space.  Note that for this feature to work pretty well, you'd need to load palettes when you launching LabVIEW (Tools»Options»Controls/Functions Palette). 

0 Kudos
Message 12 of 15

Thank-you, Kyle!  I figured that color box constant would be floating around somewhere.


Any ideas about how to access the plot name from the cursor list box, via the diagram?


0 Kudos
Message 13 of 15

Hi aliasThree,


Do you want the Plot name or the Cursor name?  Here's an example for 2 ways of getting Cursor Names using Property Nodes.  In order to get the Plot Name, it would be similar to the lower method, but using the Active Plot and Plot Name properties:




0 Kudos
Message 14 of 15

Sorry to bring back to life such an old post, but it made me understand I was not alone to see weird behavior for the Cursor.Plot property and the problem still occurs under LV2016. I am writing the result of my experimentations and hopefully a solution to the question.


I think AliasThree and RavensFan had trouble understanding each other because they were not seeing the same behavior for the Cursor.Plot property. For RavensFan, this property was working OK and returning the current Plot to which the cursor was snapped to, even if the Cursor was attached to All plots, thus answering the question.

But AliasThree was modifying programmatically the property to attach it to All plots (-1), and after that it would only give back the value -1. The answer is that it takes a certain time to reattach the cursor to a particular plot once the property is set to -1, and this is done asynchronously.

In the following example (in French, sorry), the value of Cursor.Plot before is always -1, but the value of Cursor.Plot after is sometimes -1 and sometimes the same as Selected plot.TestCursorPlot.png



So it takes roughly 2ms on my system for the plot to snap to a particular plot. If I remove the line where Cursor.Plot is set to -1, everything works fine, but the user can no longer change the selected plot. The workaround that I have found is to write a while loop testing if Cursor.Plot is still -1 or has changed for a particular value. It works well as long as there is at least one plot in the Graph, otherwise it keeps its -1 value.

0 Kudos
Message 15 of 15