4

I am using TVertScrollBox in a Delphi FireMonkey app that needs to work on Android, iOS, and Win32. My app works fine on Win32, that is, when the box is bigger than the available area, I get a scroll bar, and I can scroll it.

However, on Android, the box just shows as many items as it can, but refuses to scroll. The expected behaviour is that I can drag a point inside the box and cause the box to scroll.

Here is the relevant code:

with TVertScrollBox.Create( Self ) do
begin
  Parent := Self;
  Align := TAlignLayout.alClient;

  // AddObject several times here...      

  UpdateStyle();

  Visible := True;
end;
spierepf
  • 2,774
  • 2
  • 30
  • 52

1 Answers1

1

You must make sure that the Components/Objects you put inside your VertScrollbox is Taller/Higher that VertScrollBox.

If the component inside the VertScrollBox is smaller or shorter, VertScrollBox wont have any effect

with TVertScrollBox.Create( Self ) do
begin
  Parent := Self;
  Align := TAlignLayout.alClient;

  // AddObject several times here...      
  // try setting yourobject.Height to TVertScrollBox.Height*2
  // align yourobject to alTop

  UpdateStyle();

  Visible := True;
end;
peiman F.
  • 1,648
  • 1
  • 19
  • 42
  • I may be wrong, but this seems obvious to me. The components I am trying to scroll are indeed larger that the container that I am trying to scroll them in. Otherwise, I wouldn't expect them to scroll. – spierepf Jul 07 '14 at 19:15
  • I works, thank you very much. I though it was bigger but it happened that I put my inside elements to `align: Center`. Therefore, the content inside would never be bigger than the `TVertScrollBox`. – Soon Santos Apr 09 '19 at 13:27