How to disable MenuBar when putting up a modal-acting dialog?

If you are going to put up a dialog that you want to imitate acting modally, how can you disable all the items on your menubar while it is up?

I’m using the ApplicationCommandManager and MenuBarModel approach; currently developing on MacOS.

I’m not specifically using the ModalComponentManager; but using that doesn’t seem to do anything to the Global Menu Bar anyway, or prevent menu commands from being invoked.

For example, in Photoshop, if I open a FileBrowser to load a file, every single command on every single menu becomes grayed out. Isn’t there a way to accomplish this in JUCE?

I think you can call MenuBarModel::menuItemsChanged to update the enablement state of the items in the menu. The items in the PopupMenu will need to compute their isEnabled state depending on the currently focused/modal window in order to get the desired effect.

Thanks - but what is it that would cause all popupItems to consider themselves to be disabled? Do you somehow tell the ApplicationCommandManager that the window going up handles nothing?

You can set the isDisabled flag of the ApplicationCommandInfo to disable a command.

1 Like

Ah, yes - thanks so much. You can just have ApplicationCommandTarget::getCommandInfo() set result.isActive(false) on the way out for all commands based on some situation.