LabVIEW Project Providers

cancel
Showing results for 
Search instead for 
Did you mean: 

Enable/disable menu item

Hi,

I would like to ask, how can I selectively enable/disable custom menu items. For example, I added "Tools/example item 1"  and "Tools/example item 2" to LabVIEW tools menu and I want, based on certain conditions disable/enable these items - based on where they are called from (whether from init screen, from  VI or from project). I also want to conditionally disable "example item 2", so that it will disabled until "example item 1" is called and executed. I know this is possible since several LabVIEW toolkits use this. Can someone please advise me on how this is done?

0 Kudos
Message 1 of 8
(6,103 Views)

Are you referring to the right-click menu item? If so, that's pretty straight forward. Typically I would do that in the OnPopupMenu.vi method. Here's an example of that:

OnPopUp.png

 

 

The source code for this provider is available on my GitHub: https://github.com/TomsLabVIEWExtensions/Toggle-Debugging

 

Hope this helps 🙂

0 Kudos
Message 2 of 8
(6,095 Views)

Sorry, I re-read your message and you specifically asked about the LV Tools menu.

 

I haven't been able to find a way to do that (yet) as typically you initialize your tools menu in the init.vi method (which is only run once).

 

I will edit this reply if I come across anything.

0 Kudos
Message 3 of 8
(6,094 Views)

Thank you for your reply McQuillan,

yes, I am looking for the disabling of tools menu items. What I want to do looks like this example from Tools/Advanced menu with items "Export Strings..." and "Import Strings...":

Rashek_1-1575278256684.png

0 Kudos
Message 4 of 8
(6,092 Views)

Hi Rashek,

I don't think this is possible.

Unfortunately  "Export Strings..." and "Import Strings..." is not implemented as a provider.

0 Kudos
Message 5 of 8
(6,088 Views)

Yeah, I would tend to agree with Hypiz. I'm normally pretty good at finding the source code for the native LV plugins to use as examples - I was able to find Mass Compile. But I couldn't find Export Strings anywhere in program files (I did a global "everything" search on my PC, then manually looked in the <labview>\project directory and the providers directory).

0 Kudos
Message 6 of 8
(6,084 Views)

It should be possible, for example this Add-on has it.

Rashek_0-1575283258211.png

0 Kudos
Message 7 of 8
(6,078 Views)

Wow, you're right.

The magic is hidden in GlobalItemInterfaceVI / Global_OnUpdateCommand.vi which is called item by item and where you can modify each of them.

Is it enough like this or shell I be more specific?

Message 8 of 8
(6,064 Views)