Re: macOS Default Menu Handling

Ryan Ogurek <[email protected]> Sun, 31 May 2026 19:17:50 -0700 (PDT)
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
------=_Part_363038_952873584.1780280270004
Content-Type: multipart/alternative; 
	boundary="----=_Part_363039_278496845.1780280270004"

------=_Part_363039_278496845.1780280270004
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Oh, nevermind.

I'm not sure why I was thinking changing the `s_macAboutMenuItemId` would=
=20
change anything...

Indeed, the label is replaced in any case, afaics, which seems to wholly=20
defeat the (relevant bits of) logic in CreateAppleMenu().

So, what's going on here?

On Sunday, May 31, 2026 at 10:10:07=E2=80=AFPM UTC-4 Ryan Ogurek wrote:

> Hello,
>
> I've been looking at the way wxWidgets handles the macOS "default" items=
=20
> like "About" and "Preferences," and I'm a bit confused by it, stepping=20
> through the code with a debugger a bit.
>
> I see CreateAppleMenu() and MacInstallMenuBar() in menu_osx.cpp, where in=
=20
> the former the About and preferences items are added unconditionally (if=
=20
> the static item ids are set) to a menu added to all menu bars (afaics).
>
> CreateAppleMenu() creates "About %s" with the GetAppDisplayName() and=20
> "Preferences..." with the correct accelerator (although "Preferences..." =
is=20
> outdated, and macOS uses "Settings..." now, but that's an aside).
>
> In MacInstallMenuBar() though, whenever these menu items are found, the=
=20
> item labels are replaced with the labels from the `wxItem`. This ends up=
=20
> replacing the labels created in `CreateAppleMenu()` (which were what I'd=
=20
> expect a macOS app to have, more or less).
>
> For these menu items, I don't provide a label, so it just replaces it wit=
h=20
> the stock label and accelerator.
>
> Is the intent that a non-stock item id should be set (in the=20
> macOS-specific static fields in wxApp, e.g. `s_macAboutMenuItemId`) for=
=20
> About in order to circumvent wxWidget's default handling, and instead the=
=20
> macOS specific default handling labels to persist?
>
> If that's intentional, I suppose it is what it is, but it just seems=20
> rather awkward, so I thought I'd ask.
>
> Thank you,
> Ryan Ogurek
>

--=20
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---=20
You received this message because you are subscribed to the Google Groups "=
wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/wx-users/aa=
c0b87f-9815-4423-af69-850ad63ffa37n%40googlegroups.com.

------=_Part_363039_278496845.1780280270004
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Oh, nevermind.<div><br /></div><div>I'm not sure why I was thinking changin=
g the `s_macAboutMenuItemId` would change anything...</div><div><br /></div=
><div>Indeed, the label is replaced in any case, afaics, which seems to who=
lly defeat the (relevant bits of) logic in CreateAppleMenu().</div><div><br=
 /></div><div>So, what's going on here?</div><div><br /></div><div class=3D=
"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Sunday, May 31, 202=
6 at 10:10:07=E2=80=AFPM UTC-4 Ryan Ogurek wrote:<br/></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb=
(204, 204, 204); padding-left: 1ex;">Hello,<div><br></div><div>I&#39;ve bee=
n looking at the way wxWidgets handles the macOS &quot;default&quot; items =
like &quot;About&quot; and &quot;Preferences,&quot; and I&#39;m a bit confu=
sed by it, stepping through the code with a debugger a bit.</div><div><br><=
/div><div>I see CreateAppleMenu() and MacInstallMenuBar() in menu_osx.cpp, =
where in the former the About and preferences items are added unconditional=
ly (if the static item ids are set) to a menu added to all menu bars (afaic=
s).</div><div><br></div><div>CreateAppleMenu() creates &quot;About %s&quot;=
 with the GetAppDisplayName() and &quot;Preferences...&quot; with the corre=
ct accelerator (although &quot;Preferences...&quot; is outdated, and macOS =
uses &quot;Settings...&quot; now, but that&#39;s an aside).</div><div><br><=
/div><div>In MacInstallMenuBar() though, whenever these menu items are foun=
d, the item labels are replaced with the labels from the `wxItem`. This end=
s up replacing the labels created in `CreateAppleMenu()` (which were what I=
&#39;d expect a macOS app to have, more or less).</div><div><br></div><div>=
For these menu items, I don&#39;t provide a label, so it just replaces it w=
ith the stock label and accelerator.</div><div><br></div><div>Is the intent=
 that a non-stock item id should be set (in the macOS-specific static field=
s in wxApp, e.g. `s_macAboutMenuItemId`) for About in order to circumvent w=
xWidget&#39;s default handling, and instead the macOS specific default hand=
ling labels to persist?</div><div><br></div><div>If that&#39;s intentional,=
 I suppose it is what it is, but it just seems rather awkward, so I thought=
 I&#39;d ask.</div><div><br></div><div>Thank you,</div><div>Ryan Ogurek</di=
v></blockquote></div>

<p></p>

-- <br />
Please read <a href=3D"https://www.wxwidgets.org/support/mlhowto.htm">https=
://www.wxwidgets.org/support/mlhowto.htm</a> before posting.<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wx-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wx-users+u=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
wx-users/aac0b87f-9815-4423-af69-850ad63ffa37n%40googlegroups.com?utm_mediu=
m=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/wx-users/a=
ac0b87f-9815-4423-af69-850ad63ffa37n%40googlegroups.com</a>.<br />

------=_Part_363039_278496845.1780280270004--

------=_Part_363038_952873584.1780280270004--