Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluid/Dynamic layout in Firemonkey / Delphi

Let's say I want two shapes on a form sitting side by side taking up exactly 50% of the window each, which resize when the window is resized. How can I do that?

What I really want is to set things up in ratios.. eg.. Have one of the above shapes take up 25% and the other take 75%

The dynamic resizing is very important, and I don't want to have to type any code to achieve this.

like image 550
NoPyGod Avatar asked Aug 09 '12 01:08

NoPyGod


1 Answers

Can be achieved by dropping a TLayout on the form - Setting the Align option to 'alscale'

Then adding 2 items to the TLayout I.e for my example TPanels - with align options on both set also to 'alscale'. Set the widths of each to the ratio you want.

Form On Creation:

Form on creation

Form On Resize: enter image description here

Can be achieved with 'no code -'for the images above I just added labels to display panel widths on form resize. Hope this helps Paul

like image 112
Paul Heinrich Avatar answered Sep 24 '22 06:09

Paul Heinrich