Objects added to TVertScrollbox - problem in scrolling

0

I'm using a TVertScrollBox and i add some objects from code (TFrame with a Layout and three Label inside). The objects appear correctly, but when I move the scroller, the position of some labels, font size and bold status change in a random way. This happens in the same manner on Win32 and on Android.
The problem doesn't appear if i add manually (but is unuseful for my application) the Frames with the designer, inside the ide.
Someone can help me? Where is my mistake?
Thank you
Fabio


A fragment of my code, used for test. I assign Parent property of the Frame to the VertScrollBox. I have tryed the InsertComponent method too, but with no result.

...
arr : array[0..50] of TFrameValue;


...
procedure TForm1.FormShow(Sender: TObject);
var
  i : integer;
begin
  VertScrollBox1.BeginUpdate;
  for i := 0 to 20 do
    begin
      arr[i] := TFrameValue.Create(nil);
      arr[i].Parent := VertScrollBox1;
      arr[i].Name := Format('frame%d',[i]);
      arr[i].Align := TAlignLayout.Top;
      //VertScrollBox1.InsertComponent(arr[i]);
    end;
  VertScrollBox1.EndUpdate;
end;

  • Accepted Answer

    Monday, August 28 2017, 08:26 AM - #Permalink
    0

    Always use the Content property of the scrollbox as parent:

    arr[i].Parent := VertScrollBox1.Content;

    The reply is currently minimized Show
  • Responses (2)
    • Accepted Answer

      Friday, April 27 2018, 10:18 AM - #Permalink
      0

      10.2 had a bug for labels (corruption of style, fontsize, color, alignment). Upgrade to 10.3

      The reply is currently minimized Show
    • Accepted Answer

      Tuesday, February 13 2018, 11:20 PM - #Permalink
      0

      I have the exactly same problem. I am working on Delphi XE10.2 version. The Robert's solution did not work. Any one can help with this?

      The reply is currently minimized Show
    Your Reply

    Please login to post a reply.........