How to remove a windows background color?

I set a windows background colour, and set Custom Colour to ON.

Then I want to have a normal window back so set the CustomColour to OFF.

So far so good - however that does not reset the custom colour back to normal, and my code referencing the window’s background colour is still using the disabled colour.

How can I reset the colour to the normal window colour?

Works here, with just one more line.
Think…

You’re such a tease.

But setting it to a specific colour won’t work as the window type could be different (e.g. be a Document or a Metal window).

Need sleep …

[quote=221203:@Markus Winter]You’re such a tease.

But setting it to a specific colour won’t work as the window type could be different (e.g. be a Document or a Metal window).

Need sleep …[/quote]

What do you do after painting a canvas ?

Good night. You will feel refreshed tomorrow :wink:

Clean the brushes …?

Now I want to know Michels solution too. While waiting ;), maybe you can store the current window color in a property before changing it?

Nice play on words … very clever

But it’s not a valid command … :stuck_out_tongue:

Self.HasColor = False Self.Invalidate

Hope you did not lose sleep over it :wink:

:smiley::smiley: :smiley::smiley: :smiley::smiley:

Thanks, but I should have explained a bit more.

I’m trying to make a transparent custom control based on a ListBox. Works well so far, even when I set the Window background colour to a custom colour IN THE IDE.

However if IN THE IDE I then set the window to not use the custom colour, then the background colour is still set. And there doesn’t seem to be a way to reset it.

And as I’m using the background colour in my code that BackgroundColor mucks up my drawing …

So I’m fine unless I change a window’s background colour in the IDE, then I have only two options:

a) undo everything until the color change is reversed
b) copy everything over to a new window

Both options are a PITN …

Morse code?

Seems to spell OTTO …

What do you mean ? When I set in the Background section of the IDE Custom color to off, it just reverts to no color…

Not here.

If I

turn on has background color for a window
set the color to golden
turn off has background color

then the background color is still golden (I see it in the IDE), it is just not “used” when I run the app (the window background is grey)

That’s where my problem comes from.

That is with the latest Xojo version.

Will try a restart tomorrow, maybe it’s one of those weird and wonderful effects of running for weeks …

[quote=221453:@Markus Winter]Not here.

If I

turn on has background color for a window
set the color to golden
turn off has background color

then the background color is still golden (I see it in the IDE), it is just not “used” when I run the app (the window background is grey)

That’s where my problem comes from.

That is with the latest Xojo version.

Will try a restart tomorrow, maybe it’s one of those weird and wonderful effects of running for weeks …[/quote]

Markus, I just tested with 2015R2.4 under Mac OS X El Capitan and Windows 10. I assure you when I switch HasBackColor to off in the IDE, the window reverts to native grey.

If for some extraordinary reason that was not the case for you after a restart, apply the workaround I posted …

The window reverts, but not the color selector in the IDE. The back color in the selector is still changed and does not change back for me.

When I refer to the window backcolor in code I get the color which is shown in the selector, not the grey of the window.

The window shows grey because “has backcolour” is off, not because the back color is grey.

[quote=221461:@Markus Winter]The window reverts, but not the color selector in the IDE. The back color in the selector is still changed and does not change back for me.

When I refer to the window backcolor in code I get the color which is shown in the selector, not the grey of the window.

The window shows grey because “has backcolour” is off, not because the back color is grey.[/quote]

In practice, and beyond some angst about seeing gold in the IDE, what is the difference ? What counts is the end result : native grey as background in the executing program.

If you really cannot bear the idea that the color can somehow escape from its cage and jump into your window, why don’t you simply file a bug report ? I am sure Xojo will fix this eventually. Does not seem so difficult.

In the meantime, and because I don’t want you to have nightmares with the undead colors of Halloween, you can click on that color, and in the RGB Slider, set it to 236/236/236 or ececec. Native grey :slight_smile:

I just checked. For a newly created window the unused backcolor in the IDE is actually not native grey, but FFFFFF. White. Easy to set back.