Author Topic: Adjusting the 'Next Page Threshold'  (Read 2814 times)

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Adjusting the 'Next Page Threshold'
« on: March 28, 2014, 11:41:48 PM »
I have a scrollview with a number of items and I want to adjust the swipe delta required to progress to the next/previous item.

I tried increasing the UICenterOnChild::nextPageThreshold, but saw no change. I checked and it seems the index value it checks against is 0.

what else needs to be set?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adjusting the 'Next Page Threshold'
« Reply #1 on: March 29, 2014, 06:08:29 AM »
Index value it checks against? Not sure what index you're referring to.

Next page threshold is all you need, but keep in mind that a "page" is just the next child. So if you have this:

CenterOnChild
- Item 1
- Item 2
- Item 3
- Item 4

...then it will just go to the next child. You need this instead:

CenterOnChild
- Page 1
-- Item 1
-- Item 2
- Page 2
-- Item 3
-- Item 4

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Adjusting the 'Next Page Threshold'
« Reply #2 on: March 29, 2014, 03:21:08 PM »
looking at the code for UICenterOnChild, I saw that it was checking whether 'index > 0' before calculating which page to go to. Obviously since my index is 0 it never runs.

how can I adjust the threshold in the first setup shown (simple list of unparented children items)? Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adjusting the 'Next Page Threshold'
« Reply #3 on: March 30, 2014, 07:14:37 AM »
index > 0 check is there so that you don't go to a child with the index of -1. If your index is 0, then the code below would result in a child index of -1, which is obviously invalid.

You need to order it like I suggested, with pages. Otherwise the movement will take you to the next child, not the next page.

nguiman

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Adjusting the 'Next Page Threshold'
« Reply #4 on: March 30, 2014, 08:02:27 PM »
Thanks as always for the confirmation.

I just checked and it appears the setup of the scrollview/grid items is similar to the latter.

But I'm still receiving a zero for the index and no result when adjusting the threshold.
« Last Edit: March 30, 2014, 09:14:30 PM by nguiman »