Color of Container Control

I’ve been looking around for details on this and the information I found does not work.

I am using a 2018 version of Xojo on Mac.

I am creating a custom container control. In the inspector, transparency is off, custom color on, and the background color is set.

The color looks as expected when editing in the IDE. But when I run the program, it is not the color I set it to.

What am I doing wrong?
TIA

With 2020r2 it works as it should, at least under macOS. Have you ever tried with a more recent version?

Not yet. I will be upgrading when I get an M1 Mac. But that is another story.

So if it is just a bug in the version, then that is fine. At least I know. I think the workaround is probably to implement the paint event.

1 Like

it’s not working with 2020r2,

but you could add a rectangle with same size as container control and use the color you want.

You have to set the color when you use the container control and not in the container control itself.

There is also the paint event of the container control, which you can use to fill in with a solid color, pin stripes, gradients etc…

3 Likes

selecting a container control:

  • you can select not transparent
  • you can select a background color

the question is why does it not work ?

The container controls are layered. The color of the top most layer defines the color. But it also may be a bug.

I have a complex window with 20 containers or so. There was one label which wouldn’t show the color red on one specific container.

Yes i think it is a bug.

I had to ask because this has been mystifying me for quite some time. It seems the behaviour should be self-evident. I couldn’t see how else it might be applied, and it seemed to be so trivial a feature, that how could it be buggy? But apparently so.

BTW thanks for other ideas. I have used the paint event in the past.

1 Like