How to handle TListBox scrolling down to the last TListBoxItem in Delphi XE8?

I'm trying to create a TListBox that initially loads 15 TListBoxItems in it, and every time you scroll all the way to the bottom of the TListBoxItem, add another 15 TListBoxItems. In the multimonitors firemonkey project in Delphi XE8.

Now I cannot figure out how to find out if the user is scrolling to the end in the TListBox. I've tried every TListBox event, but none of them seem to do this.

+3


source to share


2 answers


I think you need to get a little closer to it. Instead of thinking about it in terms of when the user scrolls to the bottom of the list, think about it in terms of when the last item in the list becomes visible, i.e. When the IsVisible property of the ListBox.ListItems [ListBox.ListItems. Count - 1] .IsVisible is TRUE.

It's only TRUE when the user scrolls to the bottom of the list!



You can use a gesture manager or a simple timer to check the status.

+3


source


If the platform is Windows, you can try something like this



var
  i: Integer;
  x:Double;
Begin
  x := ListBox1.Height / ListBox1.ItemHeight;
  i :=  GetScrollPos(ListBox1.Handle, SB_VERT);
  if i + x >= ListBox1.Items.Count then
    ShowMessage('It is at the end of scroll');
End;

      

0


source







All Articles