【问题标题】:VertScrollBox Detect when bottom reached android and IOSVertScrollBox 当底部到达 android 和 IOS 时检测
【发布时间】:2018-06-30 19:47:37
【问题描述】:

我在VertScrollBox1 上有GridLayout1。垂直滚动框滚动显示网格布局的内容。我需要检测垂直滚动框何时到达底部,以便将更多内容加载到网格布局中。 每当再次到达底部时再做一次。

我怎样才能做到这一点?

【问题讨论】:

    标签: android ios delphi firemonkey delphi-10.2-tokyo


    【解决方案1】:

    使用VertScrollBox1OnViewportPositionChange()。然后一些简单的算术告诉你什么时候处于底部:

    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;
    

    由于我们比较的值是浮点数,所以使用Math.CompareValue() 进行比较。

    或者function SameValue(),也在Math单元中

    【讨论】:

    • 我猜你的意思是如果 comparevalue(NewViewportPosition.Y, GridLayout1.Height - VertScrollBox1.Height) ;)
    • 非常感谢
    猜你喜欢
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    • 2015-11-11
    相关资源
    最近更新 更多