From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Here's a scripting VI for LVClass default menu

Solved!
Go to solution

I was asked this morning for a bit of functionality that has been in LV for years but not exposed as a standalone function: how to set or clear the default menu associated with a LabVIEW class. So I did a "create subVI", cleaned up the code a bit, and put an icon on it. Figured it might be useful to other folks, so I'm posting it here. It is saved for LV 2009 and there is no password on the VI.

0 Kudos
Message 1 of 11
(3,227 Views)
Solution
Accepted by topic author AristosQueue (NI)

This "question" is answered.

0 Kudos
Message 2 of 11
(3,226 Views)

Sorry if I'm being dense, but what "default menu" does this refer to? 

0 Kudos
Message 3 of 11
(3,219 Views)

Er, this IS already exposed and I do it all the time, setting a menu for right-clicking on the object wire.......

 

Without looking at the VI posted, what exactly does it DO?

0 Kudos
Message 4 of 11
(3,199 Views)

@for(imstuck) wrote:

Sorry if I'm being dense, but what "default menu" does this refer to? 


The popup menu that you can get when you right click on a class wire. Normally there isn't one unless the developer of the class has set one in the Class Properties dialog. This bit of code sets that menu programmatically.

0 Kudos
Message 5 of 11
(3,151 Views)

@Intaris wrote:

Er, this IS already exposed and I do it all the time, setting a menu for right-clicking on the object wire.......


Really? How? I sure didn't know of a direct route to it. Yes, it is in the Class Properties dialog, but a method to set it programmatically?

0 Kudos
Message 6 of 11
(3,150 Views)

I usually go the XML down-and-dirty route.  I would make a small change to the string label though:

 

Name of .mnu file to set as Default Menu -- empty string to delete existing -- be certain to save the library after running

0 Kudos
Message 7 of 11
(3,135 Views)

@Darin.K wrote:
Name of .mnu file to set as Default Menu -- empty string to delete existing -- be certain to save the library after running

True of any scripting operation.

0 Kudos
Message 8 of 11
(3,122 Views)

You know that, I know that, but I have plenty of evidence that many people do not.  Not that I mind the Kudos and Solutions. 

 

The real goal was to see how long a label would have to become before you resorted to a caption, free label, control description or VI description.  Smiley Wink

0 Kudos
Message 9 of 11
(3,117 Views)

@Darin.K wrote:
The real goal was to see how long a label would have to become before you resorted to a caption, free label, control description or VI description.  Smiley Wink

Oh, that's short for me. Ask anyone on LV R&D... as length of variable name/function name increases, the probability of it being written by me rises, hitting certainty somewhere around I think 40 characters. And that's in the text languages. In G, where I'm not typing the names? Oh, I've been known to put paragraphs in labels in my own personal code. I don't ship stuff like that out to you folks because I know it isn't kosher. 🙂

0 Kudos
Message 10 of 11
(3,103 Views)