I am having some issues with ScrollView

Firsly, my scroll view consists of many large buttons which take a large portion of space in the scrollview. If I try to scroll but initially put my finger on a button the scrollview will not scroll.

So if I want to scroll i need to avoid initially tapping the buttons which is an effort and not a very easy one. I need to be able to scrolll even if my initial touch was on a button. The focus on the button is removed when my finger is no longer on it but I still cant scroll. How can I fix this?

I am using widget.newScrollView() and widget.newButton()

Secondly, my scrollview is a horizontal scrollview. And the horizontal scrollbar is not displayed. Why?

Heres the code

scrollView = widget.newScrollView({ width = \_W, height = \_H, scrollHeight = \_H\*2, locked = false, hideBackground = true, horizontalScrollDisabled = false, verticalScrollDisabled = true, hideScrollBar = false, isBounceEnabled = true, listener = onScroll }) scrollView.anchorX = 0 scrollView.anchorY = 0 scrollView.x = 0 scrollView.y = 0

You need to listen for touch events. If a touch moves beyond a threshold distance (usually 3% of the screen width) you pass the touch to the scrollview control below by using takeFocus(). Use the onEvent listener property of the button.

Thanks that solved the first issue. But I still dont see the scrollbar. Any ideas why?

What is your config.lua?

Hi Rob, here is my config.lua

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterbox", xAlign = "center", yAlign = "center", fps = 60, imageSuffix = { ["@1x"] = 1.5, ["@2x"] = 2, ["@3x"] = 2.4, } },

Well your config.lua is not the cause.

The scrollview takes up the whole screen. I removed every other display object and still cant see the horizontal scrollbar. What may be the issue?

Do you have more content than the screen?  Are you scrolling and looking for it, or are you just looking for the scroll bar without trying to scroll?

I have more content than the screen and I am scrolling and looking for it.

I hate to have to keep asking basic questions, but have you looked in your console log for any errors?

Also can you put together a simple project with your scrollView and the assets needed to run so we can take a look at it?

Rob

You need to listen for touch events. If a touch moves beyond a threshold distance (usually 3% of the screen width) you pass the touch to the scrollview control below by using takeFocus(). Use the onEvent listener property of the button.

Thanks that solved the first issue. But I still dont see the scrollbar. Any ideas why?

What is your config.lua?

Hi Rob, here is my config.lua

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterbox", xAlign = "center", yAlign = "center", fps = 60, imageSuffix = { ["@1x"] = 1.5, ["@2x"] = 2, ["@3x"] = 2.4, } },

Well your config.lua is not the cause.

The scrollview takes up the whole screen. I removed every other display object and still cant see the horizontal scrollbar. What may be the issue?

Do you have more content than the screen?  Are you scrolling and looking for it, or are you just looking for the scroll bar without trying to scroll?

I have more content than the screen and I am scrolling and looking for it.

I hate to have to keep asking basic questions, but have you looked in your console log for any errors?

Also can you put together a simple project with your scrollView and the assets needed to run so we can take a look at it?

Rob