Centering a CView inside a parent container that stretches?

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
Post Reply
howardantares
Posts: 128
Joined: Tue Jun 21, 2016 1:46 pm

Centering a CView inside a parent container that stretches?

Post by howardantares »

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?

howardantares
Posts: 128
Joined: Tue Jun 21, 2016 1:46 pm

Re: Centering a CView inside a parent container that stretches?

Post by howardantares »

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.

Arne Scheffler
Posts: 348
Joined: Mon Jun 20, 2016 7:53 am

Re: Centering a CView inside a parent container that stretches?

Post by Arne Scheffler »

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

Post Reply