LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Cursor Selection

Hi all,

 

I've spent way too much time on this and I feel like I'm missing something. I'm plotting waveform data on a graph. I'd like to display a few cursors to show thresholds and other levels of interest. I don't allow the user to drag them. However, I'd like to let the user turn them off (i.e. make them invisible). There's not right click shortcut to that property on the menu.

 

Now I've been trying to figure an easy way to have a user select a cursor and have that trigger an event to make the cursor visible or invisible. I'm almost there. I can use the mouse up event to see if any of the cursors have been selected. On mouse up, I can see if the "selected crsrs" list has changed. If something has been added, set that cursor to invisible (or visible). Here's the hiccup. Writing to "selected crsrs" has no effect on what's highlighted in the cursor legend. So when I go to set the list back to no selection, it does nothing on the cursor legend! Frustrating.

 

Does anyone know a simple method for making a cursor visible or invisible? Barring that, why is my more specific frustration of selected cursors occurring the way it is? If it matters, I'm on LV 2015 sp1 f3

 

Thanks!

0 Kudos
Message 1 of 15
(4,121 Views)

@thutch79 wrote:

Does anyone know a simple method for making a cursor visible or invisible?

The short answer to your question is --- "Yes".  The slightly longer answer takes 1000 words, or a Picture.

 

I created a Graph and placed two cursors on it.  I created two Booleans, Hide C0 and Hide C1, which mean the "obvious" things.  The "trick" is to select the Active Cursor (0 or 1) and then "act" on it.

Hide Cursor.png

Bob Schor

Message 2 of 15
(4,089 Views)

Hi Bob,

 

Thank you for your reply. I understand how to actually hide a cursor. My struggle is how to let the user select which cursor to hide. My hope was to utilize the cursor legend to let the user select which cursor to hide. I guess my backup plan will be to create a boolean for each cursor, but that seems tedious and not easily expansible if I want a variable number of cursors.

0 Kudos
Message 3 of 15
(4,052 Views)

@thutch79 wrote:

Hi Bob,

 

Thank you for your reply. I understand how to actually hide a cursor. My struggle is how to let the user select which cursor to hide. My hope was to utilize the cursor legend to let the user select which cursor to hide. I guess my backup plan will be to create a boolean for each cursor, but that seems tedious and not easily expansible if I want a variable number of cursors.


 

Remember that you can always create an array of booleans, that will allow you to vary the number at run-time.

Message 4 of 15
(4,046 Views)

While I have little experience with them....

 

Could a custom runtime short cut help?

 

Add the short cut "hide cursor".

 

When invoked the user is offered a pop-up to select which should be hidden?

 

Just sharing the thought...

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 15
(4,041 Views)

So set the cursor to invisible AND remove it from the select crsr list?

0 Kudos
Message 6 of 15
(4,028 Views)

You may use an array of booleans to control the cursor visibility coupled to an array of color boxes to identify them (or an array of names).

This is fairly expandable.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 7 of 15
(4,025 Views)

I hadn't thought of a custom shortcut menu item. That may work. I'll look into that once I get back to this. Thanks!

0 Kudos
Message 8 of 15
(4,016 Views)

No, just set it to invisible. My ideal solution would be if right clicking on the cursor in the cursor legend gave an option for visibility. I feel like this is a shortcoming of the control and would be a nice feature add in the future.

0 Kudos
Message 9 of 15
(4,014 Views)

I hadn't played much with Cursors until your question, but they have a ton of properties, including the name of the Cursor, whether the name is displayed (or not) and where relative to the Cursor, as examples.  However, the Cursor visibility is not among the Cluster's elements.

 

If you want to address individual Cursors, you need some sort of "selection" mechanism.  If you want to do it based on the name of the Cursor (say, a ListBox), you could use the Cursor List property (CrsrList) to get all of the Names, which correspond, of course, to the Cursor Number needed to make the Cursor Visible or not.

 

Seek and Ye Shall Get Quickly Lost ...

 

Bob Schor

Message 10 of 15
(3,998 Views)