The layout of controls on main window

How to learn the layout of controls and positioning? I am stuck with GetGridCell, GetFromTRHC, GetTranslated, SubRectVertical e t c. I do understand that these helper functions are needed for rescaling the interface on resize to set relative positions but is there any intuitive way to have control’s layout?

I prefer not to use Grids and Cells. I am used to Center Relative coordinate system, like:
pGraphics->AttachControl(new ISVGKnobControl(b.GetCentredInside(32). GetHShifted(48).GetVShifted(-64) …

1 Like

Hi, thanks! It helps.

1 Like

Actually they are not needed for correct scaling, I don’t use them at all.

Basically IPlug2 seems to use a fixed coordinate system that you design to, this is the default screen width and height you set. When the window is resized, everything is scaled up or down using floating point math, as if the layout was a bitmap, ie. the layout is preserved during scaling without having to do anything special.

So you can just ignore those helpers altogether (I agree some docs on them would be helpful).

1 Like

You might also like to look at the FlexBox support in iPlug2, which is done using the yoga library.

You can see an example in Tests/IGraphicsTest