Container control background style

How can I set the background color of a scrolling container control? I have a container which is basically acting as a listbox, with lots of embedded container controls in it. On its parent page, the “Scrollbarsvisible” property is set to “Vertical.”

This all works fine, except that I can’t work out how to set a color on the background container. In the IDE, when I apply a WebStyle that has a background color to the parent container, it looks fine. But at runtime, there is no background color in that container.

So I tried adding a rectangle with a background color to the container. The color shows up, but when scrolled the color is only as high as its original height in the IDE (and yes, top and bottom of the rectangle are locked to the container). I also tried this with a canvas (again, locked to the container) with the color applied in the paint event. This also works, except that the color scrolls out of view.

Any thoughts? Is this a bug, or expected behavior?

Xojo 2018r2, macOS 10.12.6


Never mind, solved it.

In the “shown” event of the parent container, assign the style there. = someBeautifulStyle

Works like a charm.