JUCE 6.1. broke NativeMessageBox

After updating to JUCE 6.1 (from 6.0.8), I have multiple issues with NativeMessageBox on both Mac and Windows.

  1. The messagebox started to return immediately with zero without waiting for the user to press any buttons. I noticed this was caused by the added JUCE_MODAL_LOOPS_PERMITTED check in ShowDialog. I had to add JUCE_MODAL_LOOPS_PERMITTED=1 to the preprosessor definitions to get it working like before. Is this intended and the correct way to fix this? I did not see an option in Projucer anywhere for specifying this, which would have been nice if this is indeed the required way to restore old behaviour.

  2. The return values have swapped and the documentation is wrong. Pressing “yes” / “ok” now returns zero instead of one like before. OkCancelBox will now return false when OK was pressed.

  3. The message box does not block the GUI anymore like I need it to. I am showing an update message to the user (“update available, do you want to download?”), and I need the MessageBox to block the main GUI while this popup is shown. This no longer works on Windows (10), but it does on Mac.

We had a similar thing - we were previously using the non-async methods to launch native dialog boxes, but those were removed in 6.1 so we had to switch to the async methods instead.

IMO, these were some good changes which stopped us being lazy and forced us to implement the dialog boxes properly.

As @ImJimmi mentioned the default value for JUCE_MODAL_LOOPS_PERMITTED is now 0 so you’ll need to enable that preprocessor flag if you want to use the old, modal methods in NativeMessageBox.

The return values have swapped and the documentation is wrong. Pressing “yes” / “ok” now returns zero instead of one like before. OkCancelBox will now return false when OK was pressed.

Thanks for reporting, that was an error in some recent changes to the dialog window classes and has been fixed now on develop here:

This has also been fixed on develop now with the following commit where we fall back to the old-style dialog for modal alerts on Windows as the updated TaskDialog class does not support blocking, modal alerts:

Again, thanks for reporting these and let us know if you run into any more issues!

1 Like

Thank you for the fixes, I will try the develop branch out :slight_smile:

Regarding 1.), sorry I missed the info in the breaking-changes doc, I was not familiar with the modal loops term / flag and did not realise it would affect the MessageBox usage…