Dark Mode Change While Asleep?

Has anyone else noticed that if the computer is asleep when the dark mode context switch happens, that Xojo apps don’t update properly? That is, you don’t get the app.appearancechange event when the computer wakes up. I could create a timer to watch for the change but I think some built in controls also don’t update…

Still on R2019r1.1

I think Xojo must implement some sort of sleeping/wakeup events. So you can do things like store some sort of info before sleeping, and restoring states after returning. In a wakeup_event, instead of pooling states, you could handle things of appearance change. https://docs.microsoft.com/en-us/windows/win32/power/system-wake-up-events

When dealing with mobile OS’s like Android, Xojo probable will handle things like that, events like suspend and resume. A similar counterpart kind of mimicking the behavior of suspension/resume could exist for desktop.

do other apps pick up the chnaged appearance properly ?
that is a real edge case and I wonder how the notification is handled when the app resumes

In the event you can do anything. Consult any property and statuses and adjust whatever you need.

But… In the above Dark mode losing the context, as the “Dark mode” is something Xojo implemented by itself, they need to intercept such conditions and context aberrations as reported (if I understood correctly, the dark mode changed in the “suspend event” and the GUI returned crazy after resume), and handle them (like fire a timer event to an internal ReadjustThingsInCaseOfDarkModeChange()), BEFORE bubling up the resume event to the user. In such case, the “dark mode” inconsistencies should work without the user intervention.

dark mode is not something xojo implemented on their own
its actually tied into the macOS notification the OS sends out that says “hey we switched into dark mode” or out of it which ever the case may be

I wonder if when the app registers for notifications if it ncludes a suspesion behaviour that tells the OS to defer a switch to dark mode until the app re-awakens

perhaps they need to register with a “hold” behaviour

EDIT : for rick its basically the code Sam posted here

But I’ve read that some controls are not native, not auto responding the UI changes, and need Xojo side treatment, am I wrong that such parts needs differentiated treatment?

Who knows. A Xojo tester must experiment this mix of dark mode vs suspension/resume in a interface full of controls, and look for flaws.

Reread the original post
He’s not asking about why doesnt a listbox update etc
Its the entire app

And that is, I suspect, related to how the app registers for notifications that may be sent out when the app is asleep like this change to dark mode
That would make the most sense to me that the notifications simply get dropped and so its not switching on wake

It’s a cumbersome one to test as you can’t change your clock while asleep. Does anyone know of a way to make a Parallels VM actually sleep?

Can’t you change your location in the VM? The VM should fall asleep like a normal OS.

Yes, but Parallels seems to “Suspend” the VM instead of allowing it to sleep.

I’m just going to code in the bind and see what happens this eve! :wink: