Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread ScrollTop not scrolling to position
Fri, Aug 5 2016 6:54 PMPermanent Link

Trinione

ScrollPanel1.ScrollTop is not positioning after the code runs.

NOTE: I have put the code in the click event of a button and it works then.

----------------- SAMPLE CODE ---------------------
ds.DisableControls
 while not ds.Eof do
   begin
     with TLabel.Create(ScrollPanel1) do
     begin
       Caption := '';
       Layout.Consumption := lcBottom;
       Margin.Top := 20;
     end;
   end;
 end;

 ScrollPanel1.ScrollTop := 800;

ds.EnableControls;
-------------------------------------------------------------

A solution would be appreciated.

l27
Fri, Aug 5 2016 9:46 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/5/2016 6:54 PM, Trinione wrote:
> ScrollPanel1.ScrollTop is not positioning after the code runs.
>
> NOTE: I have put the code in the click event of a button and it works then.

Looks like a order of processing and redraw issue so i would suggest to
try calling scroll asynchronously.

create a new procedure to do actual scroll

procedure st(x:integer);
begin
  ScrollPanel1.ScrollTop := x;   
end;

and then instead of
  ScrollPanel1.ScrollTop := 800;
call
  async st(800);

and see if this fixes things

Raul
Sat, Aug 6 2016 7:55 AMPermanent Link

Trinione

Raul:
It worked perfectly. Thank you.
Tue, Aug 9 2016 8:26 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< ScrollPanel1.ScrollTop is not positioning after the code runs. >>

In what context is the code running ?  In a form's OnCreate, etc. ?

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Aug 10 2016 9:50 AMPermanent Link

Trinione

<< In what context is the code running ?  In a form's OnCreate, etc. ? >>

In a procedure called from the form's OnShow event. It works perfectly now with the 'async' call.
Image