# \[BR\] Issues with native alert windows

**URL:** <https://forum.juce.com/t/br-issues-with-native-alert-windows/69732>\
**Category:** General JUCE discussion\
**Created:** [October 17, 2026, 12:42am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732 "2026-10-17T00:42:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [October 17, 2026, 12:42am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/1 "2026-10-17T00:42:32Z")

</div>

Hi there!

Thanks for the recent changes to MessageBoxOptions which added an explicit resultCode, that’s a very welcome change!

But I have found some problems with native dialogs, specially the simple yes/cancel dialogues and the order in which the buttons are displayed. (These dialogues are very common, so I think it would be a good idea to add one to the DemoRunner, by the way).

On Windows the custom is to place [YES] on the left and [CANCEL] on the right. On macOS, iOS and Android it is the other way around, with [CANCEL] on the left and [YES] on the right.

On both macOS and Android (but not on iOS) JUCE currently reverses the order of the buttons on native dialogues relative to the order used in the MessageBoxOptions. So if I create a dialogue adding first the yes button and then the cancel button, it will display the native dialogue “correctly” on all platforms, except on iOS.

Also, the documentation states that “On Android, native message boxes may be dismissed by tapping outside the box. In this case, the result code will match that of the final button in the MessageBoxOptions. If there are no buttons, the result code will be 0.”

Nevertheless, I have found that the result code is always 0 when closing by tapping outside of the box (which I think makes more sense anyway) and does NOT match any button.

Also, on iOS the leftmost button on a two-option dialogue is marked bold. It should be the rightmost button.

It would be brilliant if these minor issues could be fixed so that native dialogues behave more consistently.

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [October 17, 2026, 8:36am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/2 "2026-10-17T08:36:37Z")

</div>

I think it would be best for the API to explicitly determine the default button (selected with enter) and the cancel button (selected with cancel or tapping elsewhere in the case of Android), for example:

`.withDefaultButton ("OK", 1)`  
`.withCancelButton ("Cancel", 0)`  
`.withButton ("Tell me more", 2)`

That way when using non-native dialogues it would be possible to determine the order as one pleases but when using native dialogues these would be placed on their “correct” spot with no guesswork involved.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [October 23, 2026, 11:48am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/3 "2026-10-23T11:48:45Z")

</div>

Thanks for the feedback. We’ve added the ability to specify primary/cancel/destructive buttons here:

> <https://github.com/juce-framework/JUCE/commit/90795269175f8c0eff4428ef643e5ed77fd33ce2>

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [October 23, 2026, 10:17pm UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/4 "2026-10-23T22:17:01Z")

</div>

That is excellent! Tested on Android, iOS and macOS and as far as I can see everything works perfectly.

I also tested using some older Android themes, such as @android:style/Theme or @android:style/Theme.Holo. I noticed that the buttons are then displayed in a different order, but I believe that they are following the conventions used back then so that’s not a bug.

Thank you very much!

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [October 24, 2026, 4:58pm UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/5 "2026-10-24T16:58:56Z")

</div>

One question: “On Android, two- and three-button native message boxes created using  
MessageBoxOptions::withButton() no longer have cancellation behaviour (where  
the box can be dismissed by tapping outside) by default.” Why doesn’t this apply to single-button message boxes as well? Currently it is not possible to create a single-button message box which cannot be dismissed by tapping outside or using the back gesture. It would be nice to have the option.

---

<div class="post-metadata">

**Author:** ![refusesoftware](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/refusesoftware/32/20561_2.png) [@refusesoftware](https://forum.juce.com/u/refusesoftware)\
**Post date:** [October 25, 2026, 5:47am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/6 "2026-10-25T05:47:43Z")

</div>

This sounds [familiar](https://forum.juce.com/t/messageboxoptions-creates-opposite-results-for-alertwindow-vs-nativemessagebox/52899)!

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [October 25, 2026, 10:19am UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/7 "2026-10-25T10:19:41Z")

</div>

Ah yes, these problems have existed for a while now! But as far as I can tell the problems described on that thread were solved now by adding explicit button result codes and roles to the MessageBoxOptions.

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [November 3, 2026, 7:12pm UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/8 "2026-11-03T19:12:37Z")

</div>

Why do Android one-button message boxes have cancellation behaviour by default, unlike two- or three-button boxes?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [November 5, 2026, 1:41pm UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/9 "2026-11-05T13:41:57Z")

</div>

Thanks, that’s a good point. We’ve updated the single-button behaviour so that the dialog can only be dismissed if the button has the ‘cancel’ role.

> <https://github.com/juce-framework/JUCE/commit/2f89718246dc3bae227618b47f2aef2d24e1346c>

---

<div class="post-metadata">

**Author:** ![aamf](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aamf/32/19941_2.png) [@aamf](https://forum.juce.com/u/aamf)\
**Post date:** [November 5, 2026, 8:01pm UTC](https://forum.juce.com/t/br-issues-with-native-alert-windows/69732/10 "2026-11-05T20:01:13Z")

</div>

Ah that’s brilliant, thanks a ton!
