Centering a CView inside a parent container that stretches?

I have a CViewContainer which auto-sizes to keep attached to the window borders when resizing the window. Inside this container, I have added a new CView that I want to stay centered horizontally as the parent stretches, but stay the same distance from the top. To do this, in the child CView’s definition in the XML, I set autosize=“top”. But it’s not working. The view stays in the same position relative to both the top and the left, not just the top. (This is using v4.3 of VSTGUI, by the way.) Shouldn’t it center horizontally in the parent view if autosize=“top” is set in the XML .uidesc file?

I found a way around it, by overriding setViewSize in the parent container (which I already had a custom-derived class for), and moving the child view myself. Strange that such a thing is not needed for another view whose parent is simply the editor. I thought that was the purpose of those flags in the XML.

There’s no included view that can do what you want. So your solution is the only working one.