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. I solved this problem using touch listeners. Works fine when buttons are enabled.
However, when I disable the buttons with
button:setEnabled(false)
I get the same problem as before. ScrollView doesnt scroll if I put my finger initially on a button. I need all the buttons to be disabled at first so this is a problem.
Here is my button code
games[3] = widget.newButton { width = \_H\*(260/640)\*(251/296), height = \_H\*(260/640), defaultFile = "images/button.png", overFile = "images/button2.png", onEvent = function(event) if ( "ended" == event.phase ) then composer.gotoScene("game3") composer.removeScene( "mainmenu", true ) end if ( "moved" == event.phase) then local dy = math.abs( ( event.y - event.yStart ) ) -- If the touch on the button has moved more than 10 pixels, -- pass focus back to the scroll view so it can continue scrolling if ( dy \> \_W\*0.01 ) then scrollView:takeFocus( event ) end end return true end }
How can I solve the problem?