[Lazarus] Dynamic layout. Behavior of anchor + BorderSpacing

Luiz Americo Pereira Camara luizmed at oi.com.br
Tue Nov 8 02:08:26 CET 2011


I'm trying to do a dynamic layout using the Anchors feature of LCL

The Layout consists of:

- A TListView that should be aligned as alClient
- A Button to show the details (a TPanel)
- A TPanel containing the details

Initially the TPanel should be hidden. See image_1
Pressing the Show button should show the details panel moving the button 
and shrinking the list view See image_2

To get this i did:

- TListView.Align:= alClient
- To get space to the button TListView.BorderSpacing.Bottom := 40
- TPanel.Align := alBottom
- TPanel.Visible := False

The problem is with the button:
- I set the button.Top anchor to match the bottom side of TListView but 
it uses the original ListView bottom side instead of the effective 
bottom (considering BorderSpacing). The result is that the button gets 
out of the screen.

Is that the expected behavior (ignoring BorderSpacing to calculate 
anchor sides)?

Any idea how i can get the layout without using layers of TPanel?

Follows a test project

Luiz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_2.png
Type: image/png
Size: 7307 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image_1.png
Type: image/png
Size: 7175 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LayoutDynamic.zip
Type: application/zip
Size: 2149 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment-0002.zip>


More information about the Lazarus mailing list