ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
11-19-2025 10:11 AM
I am working with cursors on a project for a collaborator. My possibly impossible goal is when a mouse is hovering over an existing cursor in the graph itself, a right-click would bring up cursor right-click menu there instead of having to use the cursor legend to modify the cursor (more to allow user to change attrributes).
I already have code that will not bring up a modified Runtime Shortcut Menu for a waveform graph when hovering over a cursor in the graph (identifying cursor locations and discarding the mouse click), but I don't know how to get the above menu to save off and/or edit. Is it located anywhere that I can access it (as a .rtm file maybe)? There is no option for editing this Runtime Shortcut Menu for that menu. it is such a nicely designed menu that I want to use it if possible.
Thanks,
Randy
11-20-2025 04:02 AM
Here are a couple of options. I haven't really tested them:
12-01-2025 09:53 AM
Thanks for the suggestions.
I will have to rethink what I was going to do since there is no way to get a reference to the cursor legend during run-time. I ended up creating a cursor legend TreeControl reference using scripting, based on your example and then try to use it to register events. Even then, I discovered the Mouse Down? event only works for left-clicks for that reference. None of the Shortcut Menu events work at all. No errors, just doesn't trigger the event in the event structure.
12-02-2025 03:13 AM
Then I guess it's unclear to me what you actually want to do. I thought you wanted to show the existing menu for a specific cursor when right clicking on that cursor in the graph, which is what my example shows.
That said, my example doesn't include the very important part of moving the legend such that the relevant cursor is located where the mouse pointer is and instead moves it by a fixed amount. Doing this correctly would presumably require a bunch of code (get the XY values from the mouse down event, translate that to a cursor and use the tree properties/methods to find the offset between the tree position and that cursor in the tree).
12-02-2025 10:23 AM
Most of the other stuff you mentioned I have either done before or know how I would do it. I was just focusing on the cursor menu because I couldn't figure out how to access it outside of the cursor legend, specifically the Attributes drop down. Moving the cursor legend to the appropriate location to 'steal' the right-click seems to be the only way to do it. I was just exploring what other functionality is usable if I have the TreeControl reference to work with.
My ultimate goal was to create an add-on 'framework' where I could just drop down a VI on the block diagram and manage my cursor/annotation interactions. I want to define and place measurements on graphs (X point, Y point, X delta, Y delta, and have cursor measurements linked across graphs for synchronous measurements and movement when desired.