0
votes

In a Corona SDK project I have a scrollview and, inside this scrollview, eight buttons.

Problem is when I scroll and at the same time I start scrolling from the position where a button is located, the button touch event fires and the scrollview doesn't scroll.

I tried to implement a moved listener on the scrollview but it didn't work. Is there any way to set the focus on the scrollview when it should scroll and on the button when there's a tap?

Thanks

1

1 Answers

0
votes
local function scrollviewListener(event)
  if "moved" == event.phase then
    display.getCurrentStage():setFocus()
    scrollView:takeFocus( event )
  end  
 end

local scrollView = widget.newScrollView {
      top = screenTop + 220,
      left = screenLeft - 30,
      width = screenWidth + 30 ,
      height = screenHeight - 120,
      scrollWidth = screenWidth - 0.5,
      scrollHeight = screenHeight - 10,
      backgroundColor = {0.99, 0.99, 0.99},
      hideBackground = true,
      listener = scrollviewListener
    }
    group:insert(scrollView)