LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flattened Data in Menu ItemTag?

TL;DR: does anyone know if it would be possible to put flattened data in the "ItemTags" of a control's shortcut menu? Is there any reason why one couldn't get away with that?

 

Had a crazy idea recently:

Let's say I have a FP indicator that displays some information about an object. The class has a "FormatForDisplay()" method that formats the class private data into a string to write to a string indicator. Now, depending on the class, I may have several different operations that I could do on that class. So I'm thinking I would have a "PopulateShortcutMenu()" dynamic dispatch; when the user right-clicks on the string indicator, i'll call that method for the object that has been formatted for the display (assume that I am able to track what object I have used to populate the indicator).

 

The action to be triggered by the shortcut menu selection itself is an object (a message class) different from the class of object being displayed. What I'm wondering is, can I have the "PopulateShortcutMenu()" method insert a flattened object into the ItemTag, with a meaningful mnemonic for the ItemName, and then in the ShortcutMenu Selection event case, unflatten the ItemTag back into the object that was created?

 

It's a roundabout way to do things, yes. And maybe it would be better to just have a dynamic-dispatch UI for each class, and the UI would have specific actions and not have to deal with this weirdness. But still, it got me thinking....

 

Anybody tried something like that before? Are there any practical limitations to what you can put in the ItemTags of a shortcut menu (max size? printable characters only? etc)?

0 Kudos
Message 1 of 3
(2,632 Views)

Whenever I hear of something like this (using an existing area to encode extra data), my first thought is to use a tag, which allows you to attach custom data to any control. I don't know if the tag methods are visible if you enable scripting, but there should be a couple of VIs in <vi.lib>\utility\usertags. Of course, you could also just use any other means of data transfer, like a FGV, but this should work more like what you want, because the data is kept in the control and the reference should be accessible from the event terminals.


___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(2,610 Views)

Hi tst,

 

which LabVIEW version are you talking about? My LV2011 doesn't have a "usertags" entry in the vi.lib/utility folder...

 

Aahh, found it in "vi.lib/Usertags"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(2,608 Views)