ScrollView: Disable Vertical Scrolling

Can you just show the code where you’re creating this scrollView?

I’m away from my computer but I’ll see if I can get it… brb

Posting this from my phone so hope it works :slight_smile:

[lua]

function menu:createSelector()

   selector = widget.newScrollView{

      top = SELECTOR_Y,

      left = 0,

      width = stage.width,

      height = SELECTOR_HEIGHT,

      scrollWidth = stage.width,

      scrollHeight = SELECTOR_HEIGHT,

      rightPadding = SELECTOR_RIGHT_PADDING,

      verticalScrollDisabled = true,

      hideScrollBar = true,

      hideBackground = true,

      friction = 0.95,

      listener = function(event) self:controlMonitor(event) end

}

selector:getView()._isVerticalScrollingDisabled = true

[/lua]

after this items are added…

What happens if you don’t try to use that interior “tweak” of _isVerticalScrollingDisabled ? You’re already telling it (during creation) to disable vertical scrolling, so why do you need that additional line?

That’s when the bug happens… With that extra line gone. Here’s that little video - got it up on YouTube…

(Video removed)

After inserting content, have you tried using the “setIsLocked()” function for the vertical axis?

https://docs.coronalabs.com/api/type/ScrollViewWidget/setIsLocked.html

Actually I have not - didn’t know that locked a specific axis. Thanks for letting me know - I will give that a shot! Nate

Tried this and it wasn’t working - realized that the items that I’d been putting into the scrollview were being put into a display group first, then the display group was being put into the scrollview.  The issue was still occurring…  This was done before we had access to getView()…   I’m now putting items directly into the view and all seems to work.

Thanks,

Nate

This is yet still a bug in the latest daily build… happening consistently.  

Only way that seems to fix it is by adding this after the scrollView is created:

scrollView:getView()._isVerticalScrollingDisabled = true

Hi Nate,

What is the issue here? You’ve responded to a post which almost 2 years old. I’ll need more context before I can assist.

Best regards,

Brent

Hi Brent I thought this bug was fixed but it’s still happening two years later in my latest daily build without that extra line I added. I removed that line figuring I didn’t need it anymore and the bug appeared and I was able to scroll vertically with verticalScrollDisabled set to true. Figured this was a good place to bring that back up.

I can investigate more on my end and will keep you posted… Thanks

Nate

Hi Nate,

What is your goal? To set which axes it can scroll on when you create it? Or dynamically change that afterward?

Brent

I have a long horizontal nav that uses a scrollView… Ultimately it should scroll horizontally only while swiping left and right. It does this but it also if I pull up or down from within the scrollView, the content inside the scrollView moves up or down, then slowly retracts back vertically to center. Kinda like it’s trying to allow vertical but the content’s only laid out horizontally so it snaps vertically back. Hope that makes sense!

Hey Brent if you send me an email - nate@borderleap.com I can send you a video of the issue…

Can you just show the code where you’re creating this scrollView?

I’m away from my computer but I’ll see if I can get it… brb

Posting this from my phone so hope it works :slight_smile:

[lua]

function menu:createSelector()

   selector = widget.newScrollView{

      top = SELECTOR_Y,

      left = 0,

      width = stage.width,

      height = SELECTOR_HEIGHT,

      scrollWidth = stage.width,

      scrollHeight = SELECTOR_HEIGHT,

      rightPadding = SELECTOR_RIGHT_PADDING,

      verticalScrollDisabled = true,

      hideScrollBar = true,

      hideBackground = true,

      friction = 0.95,

      listener = function(event) self:controlMonitor(event) end

}

selector:getView()._isVerticalScrollingDisabled = true

[/lua]

after this items are added…

What happens if you don’t try to use that interior “tweak” of _isVerticalScrollingDisabled ? You’re already telling it (during creation) to disable vertical scrolling, so why do you need that additional line?

That’s when the bug happens… With that extra line gone. Here’s that little video - got it up on YouTube…

(Video removed)