I have a widget.newButton in a scrollview, it works fine. But when I click and drag on the button, the focus goes back to the scrollview and the button stops working. One little move of the scrollview and the button stops being a button, it’s onEvent isn’t called.
local myImageButton = widget.newButton { id = imageString, left = 0, top = 0, defaultFile = imageString, onEvent = ImageButtonEvent } myImageButton.anchorX, myImageButton.anchorY = 0, 0 myImageButton.x = 0 myImageButton.y = startY - yOffset scrollView:insert( myImageButton )
and
function ImageButtonEvent( event ) print ("ImageButtonEvent " .. tostring(event.target.id)) local phase = event.phase local target = event.target if ( "ended" == phase ) then print( tostring(event.target.id) .. " was released" ) doPopUp ( event.target.id ) elseif "moved" == phase then local dy = math.abs( ( event.y - event.yStart ) if dy \> 10 then scrollView:takeFocus( event ) end end end
an ideas what is stopping the onEvent? Thanks!