title: How to determine the end of ScrollView in Cocos2d-x?
body: <p><strong>Context</strong><br>
  I make a custom leaderboard through <code>ui::ListView</code>. Each element of leaderboard is the <code>ui::Button</code>. When the user taps on some position, he receives detailed statistics on this position in the leaderboard. I’m using Cocos2d-x ver. 3.8.1. For clarity, here’s my code for this: </p>
  
  <pre><code>    auto lvLeaderboard = ListView::create();
      for (int j = 0; j &lt; linesCount; j++)
      {
          Button* btnSingleUser = Button::create("btn.png”);
          btnSingleUser-&gt;setTag(j + offsetResult);
          btnSingleUser-&gt;addTouchEventListener([&amp;](Ref* sender, Widget::TouchEventType type){
              switch (type)
              {
                  case ui::Widget::TouchEventType::ENDED:
                  {
                      Button* currentButton = (Button*)sender;
                      this-&gt;pressedUserStatistic(currentButton-&gt;getTag());
                      break;
                  }
                  default:
                      break;
              }
          });
      lvLeaderboard-&gt;pushBackCustomItem(btnSingleUser);
      …
      }
      lvLeaderboard-&gt;setItemsMargin(0);
      lvLeaderboard-&gt;setGravity(ListView::Gravity::CENTER_HORIZONTAL);
      lvLeaderboard-&gt;setSize(Size(winSize.width, _height));
      lvLeaderboard-&gt;setPosition(Point(0, 0));
      listContainer-&gt;addChild(lvLeaderboard);    
  </code></pre>
  
  <p>All works fine, I can scroll the leaderboard, and see the statistics of each user to whom I tap.<br>
  <strong>Problem</strong><br>
  But there’s one problem. I need to load the next portion of data, when the user reaches the end of the list (I download the results on 50 lines at a time). But I can’t to find the variable, method or handler, which works when the user reaches the first or last element of the ListView.<br>
  <strong>I tried to do</strong><br>
  <a href="http://www.cocos2d-x.org/reference/native-cpp/V3.9/dd/d0c/classcocos2d_1_1ui_1_1_list_view.html" rel="nofollow">ui:ListView</a> inherits <a href="http://www.cocos2d-x.org/reference/native-cpp/V3.9/d8/d29/classcocos2d_1_1ui_1_1_scroll_view.html" rel="nofollow">ScrollView</a>, so I tried to find some methods in both of them. Everything I tried, let not the result I want.<br>
  <strong>Question</strong><br>
  How can I determine when the user reaches the first and last element in <code>ListView</code>? Or, if this not possible, how to determine the end and beginning of the <code>ScrollView</code>?</p>