我有一个TVertScrollBox
和一堆流布局,它们是在运行时通过滚动框生成的。它是一个加载帖子的应用程序,我想在用户到达TVertScrollBox
底部时加载 10 个新帖子(布局)。
我尝试使用 ViewportPositionChange
事件
//-scroll is a TVertScrollBox
uses Math
procedure TForm1.scrollViewportPositionChange(Sender: TObject;
const OldViewportPosition, NewViewportPosition: TPointF;
const ContentSizeChanged: Boolean);
begin
if CompareValue(NewViewportPosition.Y, scroll.Content.Height ) = EqualsValue then
begin
ShowMessage('lets start loading new posts');
end;
end;
这种尝试的问题是它仅在 VertScrollBox 上存在两个流布局时才有效,这显然意味着我做错了..
我怎样才能正确地做到这一点?