LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Making menubar items invisible?

We can make a menubar item dimmed, but it does not list VISIBLE as an available attribute. Does anyone have a way to remove an item from a menu, and put it back later?

 

Reason: We have a service panel that we wanted to make available to normal users in read-only format. Initially, I just made the code dim items we did not want the users to be able to control. Unfortunately, the code has many places where things dim during certain functions ("don't click me until I am done") and undim when done. This causes things that we want disabled to come back. After realizing how many places do this, I decided to just make off-limits buttons INVISIBLE. It makes the panel look funky (holes and gaps with nothing) but then the existing code and dim/undim all it wants without any impact.

 

I wanted to do the same thing to menubar items, and even tried the VISIBLE attribute and confirmed it was not allowed.

 

Ideas appreciated.

0 Kudos
Message 1 of 4
(278 Views)

Hi,

 

not the quickest approach, but you can programmatically build and destroy menus.. DiscardMenuItem makes an item invisible, by removing it, and NewMenuItem makes it visible again by adding it again...

 

my morning thought...

good luck,

Wolfgang

0 Kudos
Message 2 of 4
(252 Views)

@Wolfgang wrote:

not the quickest approach, but you can programmatically build and destroy menus.. DiscardMenuItem makes an item invisible, by removing it, and NewMenuItem makes it visible again by adding it again...

That is an interesting idea. I already made a routine that handles controls (like Toggle Buttons) act like Radio Controls (select one, others unselect). Maybe I just write a menu handler that creates/destroys/recreates the menu on-demand with options flagged invisible not showing up. That sounds like a good excuse to learn how to program menus outside of the UI editor. Thank you.

0 Kudos
Message 3 of 4
(224 Views)

Another approach could to use InstallMenuDimmerCallback: this installs a callback that is automatically called every time the menu is displayed. In the dimmer callback you can dim items that are not allowed in the actual state of operations.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(202 Views)