Random background change in Xojo

154 Views Asked by At

I've tried to create a button in Xojo, so every time I press it the background color should randomly change. The name of my window is just Window1. I can't figure out how to do it. I would appreciate an example please. I know how to generate random colors, but how to do it with the background?

1

There are 1 best solutions below

0
On

If you've already tried to set the background color, please also ensure the HasBackgroundColor property of your window is set to True:

Self.HasBackgroundColor = True
Self.BackgroundColor = Color.Red // Use your random color variable instead