简体   繁体   中英

FMX firemonkey how to Scroll a vertical scroll box in runtime

Somebody can help me how to scroll a vertical scrollbar in firemonkey in runtime, there is a property scrollby, but it didnt work, I don't have any ideia how to solve it.

Thanks

There is no independent vertical scroll bar component in FMX. There are however several scroll box components. A TVertScrollbox (VSB) is one of them. If you use that, you can safely set VSB.Align:= TAlignlayout.Client . The VSB never scrolls itself. It only scrolls the content if the content exceeds the vertical dimension of the VSB.

You can put a TLayout on the VSB, then set it's alignment to VertCenter , and it's Height to VSB.Height * 2 . At runtime, the vertical scrollbar will appear, and you will be able to scroll the layout up and down. After this, you can adjust the position of the layout on the screen by calling the Scrollby and ViewPortPosition methods of the VSB.

Use a TScrollBox set TAlignlayout.Client then put the components inside the Tscrollbox and set them TAlignlayout.top and Done. When the content exceeds the vertical dimension the scroll will appear.

in delphi and C ++ Builder in FMX you can use ScrollBy (int, int); to move the scroll

Exemple:

      this->ScrollBox->ScrollBy(0, - this->ScrollBox->Width);

I used a negative value because this will make the scroll move downwards following the pre-filling of items.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM