Smart Mobile Studio was released today. To celebrate this – in my opinion – very important step for the Object Pascal language, I have prepared a series of articles on the Layout Manager – a feature of the Smart RTL that I wrote.
Smart is an excellent tool, but in some areas it clearly shows that there was only so much time allowed for the development. I’m sure Lennart will polish the rough edges in next releases but for now we have to do with what we have.
One of those rough edges is component placement. You can drop components on the designer and set their size but there’s no mechanism for dynamic size adjustments. In other words – there is no Align, no Anchors, no Margins and no layouts (as TFlowPanel and TGridPanel in Delphi). We have to resize components in code, in the overloaded Resize method.
I quickly got sick of writing resizing code and decided to alleviate the problem by writing a layout manager. It does not work in the designer, you have to declare and use it in code, but still it is a big simplification over the default “just call SetBounds from Resize” approach. I donated layout manager to the Smart project and it is included in the 1.0 release as the w3layout unit.
This article starts a short series which will explain layout manager on simple examples. All of those examples are also included with the Smart installations (look in Demos, LayoutManagerDemo).