Update for modal components in plugins

Hello chaps. I’ve just checked in some code that uses extreme cunningness to try to improve the safety of modal components in plugins.

Some of you have hit the problem where a juce menu or dialog box is active, and the user clicks on some other bit of host UI that deletes the plugin window and it all goes bang later when the stack unwinds. Well, try the latest version, which should block most extraneous mouse clicks and keystrokes, making it all much safer.

The only thing I’ve not figured out yet is how to stop the mac menu bar from being used while something is modal - if anyone has any suggestions, that’d be welcome!

It may sound a little idiotic, but I have never coded for a plug-in, so please excuse me if I am wrong. If you don’t want people to access the menu you can always disable it before entering modal and enable it once controls comes out of the modal.

I don’t think there’s a way of disabling the menu bar without actually hiding it…

Hi Julian,

   I should have put it clearly, I didn't mean to disable the menu bar, but to disable all the menu items in the menu bar.

Yeah, but the items don’t belong to the plugin, so it feels a bit risky to start disabling them. Might be possible to safely disable just the top-level items, perhaps.

You have a valid point there, But I am not sure if there is anyway of disabling the main menu, but it’s worth a try. :slight_smile: