Issue when using multitouch, scroll view, and widget button

Hey everyone, could really use some help here. I tried to strip everything down so I could help arrive at the most simple issue. 

When I run the code below the widget button works find on first launch. The scroll view takes focus when the button is move more than 10 pixels. After If drag on the button and move the scrollView the button can no longer be clicked. 

If I remove the system.activate(“multitouch”) then everything works fine. 

Any thoughts?

local widget = require( "widget" ) system.activate("multitouch") scrollView = widget.newScrollView( { top = 0, left = 0, width = display.contentWidth, height = display.contentHeight, scrollWidth = 300, scrollHeight = 800, hideBackground = true, hideScrollBar = true , --listener = scrollListener } ) local function handleButtonEvent1234( event ) local phase = event.phase if ( phase == "moved" ) 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 \> 10 ) then print("#########") scrollView:takeFocus( event ) button1:dispatchEvent( { name="touch", target=button1, phase="ended" } ) end elseif ( phase == "ended" ) then print("ended") end return true end button1 = widget.newButton { left = 10, top = 300, id = "button1", label = "Default", onEvent = handleButtonEvent1234 } scrollView:insert( button1 ) button1.x = display.contentCenterX button1.y = display.contentCenterY

Why are you trying to complete the touch with a dispatch? You need to remove any focus the button has and return false, not dispatch.

Here is my typical framework for dealing with touches…

local function touch(e) if (e.phase == "began") then e.target.hasFocus = true display.currentStage:setFocus( e.target, e.id ) return true elseif (e.target.hasFocus) then -- do stuff here if (e.phase == "moved") then else e.target.hasFocus = false display.currentStage:setFocus( e.target, nil ) -- return false here if calling takeFocus() on the object below end return true end return false end

Why are you trying to complete the touch with a dispatch? You need to remove any focus the button has and return false, not dispatch.

Here is my typical framework for dealing with touches…

local function touch(e) if (e.phase == "began") then e.target.hasFocus = true display.currentStage:setFocus( e.target, e.id ) return true elseif (e.target.hasFocus) then -- do stuff here if (e.phase == "moved") then else e.target.hasFocus = false display.currentStage:setFocus( e.target, nil ) -- return false here if calling takeFocus() on the object below end return true end return false end