[Lazarus] Anchoring problem with ScrollBox and Panels

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
Hi All,

The attached example contains a form with a ScrollBox on it with three
Panels in it. Height of Panel1 is static, height of Panel2 depend on the
size of Form/ScrollBox, height of Panel3 can be modifiable by the user.
In the example a simple OnClick emulate the variable height feature of
Panel3. So, start the example, modify (or not) size of the form, then
click on Panel3. I got a "Position range overflow..." error. What I
doing wrong or is this a bug?

Gabor

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

position_range_overflow.png (37K) Download Attachment
ScrollBox_position_range_overflow.tar.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
Am 06.06.2017 um 19:39 schrieb Gabor Boros via Lazarus:
The attached example contains a form with a ScrollBox on it with three Panels in it. Height of Panel1 is static, height of Panel2 depend on the size of Form/ScrollBox, height of Panel3 can be modifiable by the user.
In the example a simple OnClick emulate the variable height feature of Panel3. So, start the example, modify (or not) size of the form, then click on Panel3. I got a "Position range overflow..." error. What I doing wrong or is this a bug?

I can tell you here the same as in the related bug report https://bugs.freepascal.org/view.php?id=30617, this isn't a bug it is not happy design. You want that the scrollbox height is increased, but then the Panel2 height is increased too. Simple remove anchored bottom of Panel2 and the loop is gone.

As you wrote in bug report: "Thank you for the example but do not do what I want.", please explain better, what you exactly want (step by step, when a user change the height of Panel3, what should happen).

Kind regards

Michl

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
2017. 06. 06. 19:54 keltezéssel, Michael W. Vogel via Lazarus írta:
> Simple remove anchored bottom of Panel2 and the loop is gone.

Yes, but Panel2 not follow the size of form/scrollbox.

> As you wrote in bug report: "Thank you for the example but do not do
> what I want.", please explain better, what you exactly want (step by
> step, when a user change the height of Panel3, what should happen).

Just "remove anchored bottom of Panel2" then start the example and click
on Panel3 and will see what I want. The vertical scrollbox showed up and
the user can scroll the panels. It's good but the Panel2 not resized
with the form/scrollbox without the bottom anchor. So if bottom anchor
of Panel2 exists the resizing of Panel2 work as expected, if removed the
anchor resizing (by the user) of Panel3 work as expected. But I need the
two features coexist.

Gabor
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
Am 06.06.2017 um 20:22 schrieb Gabor Boros via Lazarus:
> 2017. 06. 06. 19:54 keltezéssel, Michael W. Vogel via Lazarus írta:
>> Simple remove anchored bottom of Panel2 and the loop is gone.
>
> Yes, but Panel2 not follow the size of form/scrollbox.

Please try added example. It is nearly the same as in the bugtracker but
with aligned scrollbox and a scrollbar to switch the height of Panel3.
Is it so as you want?

Michl

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

test.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
2017. 06. 06. 20:58 keltezéssel, Michael W. Vogel via Lazarus írta:
> Please try added example. It is nearly the same as in the bugtracker but
> with aligned scrollbox and a scrollbar to switch the height of Panel3.
> Is it so as you want?

No. Attached (I hope ) a better example. The user can resize Panel2 with
the Form and can resize Panel3 with the TrackBar. But want higher Panel3
than the available space. For solve this the whole thing sit in a
ScrollBox. And the "InvalidatePreferredSize loop detected" problem
breaks this solution. I completely don't understand why Panel3 not
resizable to lower than border of the ScrollBox. Panel3 not have a
bottom anchor. From my POV (and brain) the anchors are correct. Panel2
anchored to bottom of Panel1, Panel3 anchored to bottom of Panel2 and
bottom of Panel3 not anchored.

Why got different error message with the TrackBar and OnClick resize of
Panel3?

Gabor

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

ScrollBox_position_range_overflow.tar.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
2017. 06. 06. 19:54 keltezéssel, Michael W. Vogel via Lazarus írta:
> I can tell you here the same as in the related bug report
> https://bugs.freepascal.org/view.php?id=30617, this isn't a bug it is
> not happy design. You want that the scrollbox height is increased, but
> then the Panel2 height is increased too. Simple remove anchored bottom
> of Panel2 and the loop is gone.
You wrote on the tracker:

"You have anchored Panel2.Bottom to no sibling and Panel3.Top to
Panel2.Bottom. When you now change the height of Panel3, that it doesn't
fit in the scrollbox anymore, the scrollbox is resized. With resizing of
the scrollbox, Panel2 is also resized (because its Bottom is anchored).
Now Panel3.Top is moved too and Panel3 doesn't fit in the scrollbox
anymore. And repeat."

I understand you(r description) except one thing. "Panel2 is also
resized (because its Bottom is anchored)" Why you think Panel2 is
resized? When height of Panel3 increased and the vertical scrollbox
showed up, height of scrollbox not changed nor top of Panel3.

Attached two pictures. One before resized Panel3 and one after (pressed
Continue on the loop error message). You see top, bottom and height of
Panel1 and Panel2 is same as before.

So top, bottom, height of Panel1, Panel2 and ScrollBox1 not changed. Why
got the loop error? Only height of Panel3 changed. Width of Panel1,2,3
changed, okay but why this block the work of vertical anchoring?

Gabor

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

before_Panel3_resize.png (16K) Download Attachment
after_Panel3_resize.png (19K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
Am 07.06.2017 um 07:45 schrieb Gabor Boros via Lazarus:
> I understand you(r description) except one thing. "Panel2 is also
> resized (because its Bottom is anchored)" Why you think Panel2 is
> resized? When height of Panel3 increased and the vertical scrollbox
> showed up, height of scrollbox not changed nor top of Panel3.

You can set a DebugLn in control.inc:

procedure TControl.SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer);
begin
   DebugLn('TControl.SetBoundsKeepBase ', Name, ' ', DbgS(Height));
   ChangeBounds(aLeft, aTop, aWidth, aHeight, true);
end;

You will see, the resizing problem comes from Panel2.


> Attached two pictures. One before resized Panel3 and one after
> (pressed Continue on the loop error message). You see top, bottom and
> height of Panel1 and Panel2 is same as before.
>
> So top, bottom, height of Panel1, Panel2 and ScrollBox1 not changed.
> Why got the loop error? Only height of Panel3 changed. Width of
> Panel1,2,3 changed, okay but why this block the work of vertical
> anchoring?

No, Panel2 height is changed to a invalid value, as sayed before. Panel2
is just not visible updatet, as the height get a invalid value.

To demonstrate what happen take the added example or create a new app,
put a panel on it and anchor Left, Top, Right to the form sides and
anchor Bottom to nil. Start the app and change the bounds of it.

Michl

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

test.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
2017. 06. 07. 8:37 keltezéssel, Michael W. Vogel via Lazarus írta:
> You will see, the resizing problem comes from Panel2.

I see. But don't understand. :D

> To demonstrate what happen take the added example or create a new app,
> put a panel on it and anchor Left, Top, Right to the form sides and
> anchor Bottom to nil. Start the app and change the bounds of it.

Your example work as expected. If resize the form panel resized properly.

I tried to accomplish the task in a different way. Attached a new
example. Bottom of Panel2 anchored to bottom of ScrollBox. This works.
Top of Panel2 anchored to bottom of Panel1. When resize the form top of
Panel2 is moving Why? Top of Panel2 why not stay with bottom of Panel1?

Gabor

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus

ScrollBox_position_range_overflow.tar.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Anchoring problem with ScrollBox and Panels

Free Pascal - Lazarus mailing list
Am 07.06.2017 um 09:52 schrieb Gabor Boros via Lazarus:
> Your example work as expected. If resize the form panel resized properly.
As it should. I simply wanted to show you, what happen when you anchor
the bottom of a panel: Sizing of form, sizes the panel. The same, as in
all your test projects before: Sizing of ScrollBox1, sizes Panel2.

> I tried to accomplish the task in a different way. Attached a new
> example. Bottom of Panel2 anchored to bottom of ScrollBox. This works.
> Top of Panel2 anchored to bottom of Panel1. When resize the form top
> of Panel2 is moving Why? Top of Panel2 why not stay with bottom of
> Panel1?
You have anchored it to center. The center of Panel2 is now the center
of ScrollBox1. See http://wiki.lazarus.freepascal.org/Anchor_Sides#Example_3
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus