Make a window flash


I had a search and a look at the Window class but couldn’t find an answer. Is there a way to make a window flash until the user brings it into focus?

In a forever loop, change the window background alternatively (odd / even) from Black to White until the window / process comes frontmost.

But translating that to actual code is… far above my head right now as my stomac is crying loud (12:19 right now ! here)

That would certainly do the trick, but I was hoping for something more along the lines of a Xojo equivalent for FlashWindow or FlashWindowEx in C++. Does no such thing exist?

If all else fails, I will implement what you have described.

I did it using a thread that changes the window backcolour every 300 miliseconds. Trouble is that it doesn’t flash in the taskbar which is what I actually want. If the window is mimimised, the user has no idea that the window is flashing.

FlashWindow and FlashWindowEx are functions exposed by the Windows API (not c++ specific), so you can call them from Xojo too.

Check the Windows Functionality Suite > UIExtras > Modules > WindowExtensionsWFS



Thanks Pixe, but my program is for Linux and Mac as well. Maybe I’d have to use a different alert determined by the platform the program runs upon.

There not function built in (that I know) that will let you code a proper flashing for the three platforms, so you will need to either use a solution as the one proposed above by Emile, or use platform-specific declares.

MacOsLib is similar to WFS but for OSX, I would check that too. For linux there isn’t such a compilation of functions and system API calls, as far as I know.