When you use NativeMessageBox::showMessageBoxAsync it pops the window on top of other components.
However if you now click outside the messagebox window itself, the other component will obscure the messagebox and there is no way to get to the messagebox window anymore since its obscured.
Is there any way to prevent this from happening? Ideally message boxes should be always on top of all other windows. I understand that Android doesn’t have modal behavior but this is a major usability issue if messageboxes can get hidden from the user by accidentally clicking somewhere else!
The messagebox is not hidden, it’s being dismissed. But in any case, there is a JUCE bug: dismissing the callback this way will never trigger the Callback in NativeMessageBox::showMessageBoxAsync. I’ve fixed this now on develop with commit d4e0ba0. As it’s a change in java land, you’ll need to re-save your project with the Projucer. I did this for all the JUCE example projects (commit ede622c).
Thanks Fabian. Yeah the callback was not being called. When its dismissed what is the default option selected for the messagebox and can it be specified? i.e. in a YesNo messagebox it should be No.
Will try out the fix.
In android studio I see it calling the java function showOkCancelBox (it has your changes) but when you click outside the message box none of the onClick handlers get called. As a result it never executes the alertDismissed function with the callback.
Yes I have re-saved the project from the Projucer after including your changes. I also verified in the debugger that it was indeed seeing the new code. The problem is that the onCancel call itself in the code you quoted above is never invoked when you click outside the dialog. It does get called when you click the cancel button.
My bad sorry. We had some local changes to that file so I missed merging in your code for the setOnCancelListener implementation. Thats why the callback wasn’t called. doh!
Sorry about that. It works now. Thanks