[英]VertScrollBox Detect when bottom reached android and IOS
I have GridLayout1
on a VertScrollBox1
. 我在
VertScrollBox1
上有GridLayout1
。 The vertical scroll box scrolls through the content of the grid layout. 垂直滚动框滚动浏览网格布局的内容。 I need to detect when the Vertical scroll box reach the bottom so I get to load more content to the grid layout.
我需要检测“垂直”滚动框何时到达底部,以便将更多内容加载到网格布局中。 And do it again whenever bottom is reached again.
再次到达底部时再做一次。
How can I achieve this? 我该如何实现?
Use the OnViewportPositionChange()
of the VertScrollBox1
. 使用
OnViewportPositionChange()
中的VertScrollBox1
。 Then some simple arithmetics tell you when you are at the bottom: 然后,一些简单的算术告诉您何时到达底部:
uses Math, ...;
// ...
procedure TForm1.VertScrollBox1ViewportPositionChange(Sender: TObject;
const OldViewportPosition, NewViewportPosition: TPointF;
const ContentSizeChanged: Boolean);
begin
if CompareValue(NewViewportPosition.Y, GridLayout1.Height - VertScrollBox1.Height) = EqualsValue then
Memo1.Lines.Add('At bottom, time to grow and load more content to the GridLayout');
end;
Since the values we compare are floats, use Math.CompareValue()
for comparison. 由于我们比较的值是浮点数,因此请使用
Math.CompareValue()
进行比较。
Alternatively function SameValue()
, also in the Math
unit 在
Math
单元中也可以选择function SameValue()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.