LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

adding graph cursor with keyboard shortcut

Hello,
I have the need to be able to add a cursor to a graph programmatically. I have a waterfall frequency-time display that I would like to quickly add/delete cursors in order to measure symbol rates of incoming IQ data. Using the graph cursor palette takes too long. After browsing around the forums I have found several examples on how to programmatically add a cursor using the cursor list property node but none of them use a keyboard shortcut. Preferrably I would like one key, say "c", to create a cursor at the center of the plot and another key,  say "d", to delete the active cursor. I found one example that uses the mouse down event in order to programmatically move the cursor as well as to set a cursor active if the mouse is directly on it. So, using the mouse to add/delete a cursor probably won't work since I would like to combine all of the above functionality. Has anyone tried this with cursors before?

Thanks,

Tim S.
Tim Sileo | RF Apps Engineer | NI/Emerson | ADG Business Unit
0 Kudos
Message 1 of 6
(3,625 Views)
Why not just use the Key Down or Key Down? event? The main problem would be that you would probably have to define the event for the VI and then you will need not to have anywhere else where you require keyboard clicks or filter the other cases.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,609 Views)
I haven't tried this, but can you create boolean buttons for adding and deleting the cursor, and then assign keys to the booleans?

Smiley Wink
0 Kudos
Message 3 of 6
(3,605 Views)
tst and LabviewGuruWannabe,

Those sound like relatively easy solutions. I just noticed last Friday before leaving work that the key down event can only be used with controls and not indicators. With LabviewGuru's suggestion of using a Boolean control I think it should work. I'll try it today and post back to let everyone know. Thanks for both of your suggestions.

-Tim S.
Tim Sileo | RF Apps Engineer | NI/Emerson | ADG Business Unit
0 Kudos
Message 4 of 6
(3,590 Views)
All,

Well it turns out that it was relatively simple to programmatically add cursors using keyboard shortcuts. As LabviewGuru suggested I used boolean controls for my add/delete cursor events. I used the "insert" key to toggle the add boolean and the "delete" key to toggle the delete boolean which deletes the currently active cursor. When a cursor is created it is automatically brought to the center of the plot so that it can be viewed easily. In order to test this out I used another example from the Labview forums where someone designed the cursors to snap to a mouse click position. So, that functionality is included as well. I also added the ability to use the zoom tool without messing up cursor positions as well because I will need to use the zoom tool heavily in my application. I've attached the example that I created.

Enjoy!


Tim Sileo | RF Apps Engineer | NI/Emerson | ADG Business Unit
0 Kudos
Message 5 of 6
(3,582 Views)
Thanks! tsileo. It's a good example for me.Smiley Very Happy
0 Kudos
Message 6 of 6
(3,514 Views)