In Dark Mode, some of my buttons are invisible..

I’m on a Mac, creating a Mac app, using latest Xojo2018r3. I took an existing app, recompiled with Xojo2018r3, changed nothing other than checking the Dark Mode option in the Shared settings section. My newly compiled app seems to work fine, and when I switched from Light to Dark mode, my app changed to dark mode and looked great. BUT…with further review, I noticed some of my OK and CANCEL buttons on some windows and/or dialogs were invisible. They were actually there, as I could click where I knew them to be and they worked, but couldn’t be seen. (Other buttons on the same window DID show up in Dark Mode.) Switch back to Light Mode, and the invisible buttons re-materialize. I don’t use any custom colors. I searched the Feedback app, but nothing jumped out at me, so I’m assuming the problem is mine, and not Xojo’s or Apple’s. Any idea what I might have missed? Thanks!

<https://xojo.com/issue/53541>

Grrr. Case is marked as private. Not much help to others interested in this issue. :frowning:

It’s not a bug, it’s a feature of Mojave. It’s designed to automatically simplify workflows when in Dark Mode. :wink:

Apologies. It was a beta case, there’s no reason it shouldn’t be public now.

I hope this is ok. The last entry on that case say:

Other relevant information there:

[quote]a workaround is to NOT set the button to default in design mode
then in the window open event set it to default[/quote]

Thanks everyone for the help. I’ll try the workaround for now, but I assume the final answer won’t be to never set a button to Default except programmatically.

As was stated in the case, Apple has fixed this on 10.14.1.

Yup, I realized that just after I hit POST, of course! Thanks Greg!

I just updated to 10.14.1, and had high hopes that my invisible button problem would be fixed, but apparently not. It’s rather confusing at the moment. If, in Light Mode, I bring up a dialog that I know had a button that was usable but sometimes invisible in Dark Mode, the button is there as it should be…and when I switch the Sys Pref into Dark Mode, the button in question is still visible. So a dialog or window that is open when switching from Light to Dark Mode does not show the problem. But, if (while still in Dark Mode), I close the open dialog or window and then re-open it, the button in question is NOT visible. My troublesome buttons (not all of them) apparently appear as they should when going into Dark Mode if the dialog or window is already opened. But, if opening into Dark Mode, the problem-some buttons are NOT visible. Still working on trying to figure out what’s what.

So going by what Greg says, what I’d suggest is to remove the default option from the button, so it shows up. Then in the “Activate” event of the window, check to see if that button is set to default. If not, fire a timer with a small period to set default on the button.

Also use http://bugreporter.apple.com and file yet another bug report, don’t expect your report alone to get the bug fixed, but enough people file bug reports, then hopefully someone at Apple who still cares about the macOS will notice it.

Ok, so I was excited when I tried this with 10.14.1 today because my sample project with a default button does work correctly in 2018r3 now.

If any of you have a sample that does not work, please file a new bug report so we can look at it right away.

Thanks Sam, Thanks Greg (and kudos on your test working…makes me think I’m doing something wrong not Apple, but I need more sleuthing on my end!). Sam, why did you suggest a short delay after the Activate event…was that to ensure that activate events for all the controls are already handled by the time my explicit command to set a default button is invoked?)

Experience has led me to try to stagger things like this so that (hopefully) the things you want done are executed AFTER the OS has decided to deny them.

Programming for the macOS has certainly got a lot harder in the recent years, things like this SHOULD NOT even occur in the first place, it feels like lots of things are fighting each other in the background, and with an apparent lack of care over the macOS, it just makes these little issues much more frustrating.

This behavior does not present itself in an app built with Xcode on 10.14.0
Test Xcode app

Cant help thinking there is no such thing as a default button on an iPad… the future looms… :frowning:

I can’t reproduce the Default - Disable button not showing. I can’t find a sample on Feedback.

I drag a default button to the window and change Enabled to OFF, add another regular button, Dark Mode and both buttons show. Maybe I’m doing something wrong or I need to add more controls to the window?

I believe it requires a modal window.

I need to recreate my Xcode test then :stuck_out_tongue:

No need. I’ve changed Thom’s case back to Verified.

While this issue was “fixed” in 10.14.1 beta 1, the change that Apple made was later reverted and didn’t make it into the release version. We are looking for a Xojo framework issue now, but we really need a reproducible example project.