Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

Dynamic layout. Behavior of anchor + BorderSpacing

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luiz Americo Pereira Camara

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.freepascal.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment.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.freepascal.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment-0001.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.freepascal.org/pipermail/lazarus/attachments/20111107/d1ad1532/attachment.zip>

Reply by email

silvioprog
to Luiz Americo Pereira Camara

2011/11/7 Luiz Americo Pereira Camara :

Show quoted text 33 lines
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

'Improvised' solution in attached.

Thx.

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: LayoutDynamic2.zip Type: application/zip Size: 2649 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111107/d1ca5d58/attachment-0001.zip>

Reply by email

Luiz Americo Pereira Camara
to silvioprog
silvioprog wrote 16 lines
2011/11/7 Luiz Americo Pereira Camara: > 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 'Improvised' solution in attached.

Thanks. This works.

But the question still remains:

Is a bug the BorderSpacing be ignored to calculate anchor sides?

Anyone?

Luiz

Reply by email

Hans-Peter Diettrich
to Luiz Americo Pereira Camara
But the question still remains: Is a bug the BorderSpacing be ignored to calculate anchor sides?

The various layout management extensions of Lazarus are not very cooperative :-(

Use anchor docking with care, it allows for invalid layouts even if no other layout options are used.

DoDi

Reply by email

Luiz Americo Pereira Camara
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 8 lines
Luiz Americo Pereira Camara schrieb: > But the question still remains: > > Is a bug the BorderSpacing be ignored to calculate anchor sides? The various layout management extensions of Lazarus are not very cooperative :-(

If is a bug, is not better to fix it?

Use anchor docking with care, it allows for invalid layouts even if no other layout options are used.

What do you suggest to use?

Luiz

Reply by email

Mattias Gaertner
to Luiz Americo Pereira Camara: Thanks. This works. But the question still remains: Is a bug the BorderSpacing be ignored…
Show quoted text 23 lines
On 7/11/2011 22:48, silvioprog wrote: > 2011/11/7 Luiz Americo Pereira Camara: >> 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 > 'Improvised' solution in attached. Thanks. This works. But the question still remains: Is a bug the BorderSpacing be ignored to calculate anchor sides?

BorderSpacing is used by anchored sides.
See here:
http://wiki.lazarus.freepascal.org/Autosize_/_Layout#Anchor_Sides

Mattias

Reply by email