Hi there,
I’m having an odd problem with widget buttons.
Sometimes, if I tap near the bottom of them on a device (particularly on small buttons on a small screen), the “over” state of the button is displayed but my event handler doesn’t fire.
Code for the event handler:
function handleButtonEvent(event) local phase = event.phase local btn = event.target; if ButtonsHandler:getLockLevel() \< btn.lockLevel then if "began" == phase then -- Do nothing elseif "moved" == phase then local sv = ButtonsHandler:getScrollerToPassFocusTo(); if (sv ~= nil) and (btn.inScrollView == true) then local dx = math.abs( event.x - event.xStart ) -- Get the x-transition of the touch-input local dy = math.abs( event.y - event.yStart ) -- Get the y-transition of the touch-input if dy \> 8 then sv:takeFocus( event ); end end elseif "ended" == phase then local onRelease = btn.oRel; if onRelease then result = onRelease( event ); end end end return result; end -- Then an example of a typical function I've passed as the btn.oRel function would be simply: function handleButtonTap(evt) print("BUTTON TAPPED"); end
Has anyone else experienced this?
Thanks,
Ian