It seems as if the scrollView isn’t passing events properly to any buttons added to it. The press event gets triggered but not the release event. Is there a workaround for this? I am just needing button inside a scrollview and currently this seemingly simple task is a hold up. [import]uid: 58885 topic_id: 18241 reply_id: 318241[/import]
Anyone from Ansca or anyone with any help? [import]uid: 58885 topic_id: 18241 reply_id: 70377[/import]
Have you filed a bug report with code to replicate? Can you post the # here, please?
Peach [import]uid: 52491 topic_id: 18241 reply_id: 70510[/import]
Hey Peach case #10109 I just uploaded my lua file. Maybe I should have gave some more generic code? But it’s fairly simple to reproduce and the lua file should easily show what’s going on.
I appreciate the assistance Peach! [import]uid: 58885 topic_id: 18241 reply_id: 70514[/import]
Not a problem and no, uploading the file is fine - anything that easily shows the issues is always helpful.
Peach [import]uid: 52491 topic_id: 18241 reply_id: 70532[/import]
This post might be related to what you are looking for
http://developer.anscamobile.com/forum/2011/04/16/scrollview-and-buttons
in my project, i have a whole bunch of buttons inside the scrollview and i wanted to handle and figure out which button was actually pressed.
local buttonTouch = function(e)
-- ended never happens for the buttons :(
if e.phase == "ended" then
print("button touch ended "..e.target.id);
elseif e.phase == "began" then
-- began does get fired before the scrollView gets it, so save the target ref
activeBtn = e.target;
end
end
also, i ended up tweaking the solution from that post to make it work for my project.
I added the following to the touch handler in scrollView.lua
if math.abs(dragDistance) \< 1 then
Runtime:dispatchEvent( { name="scrollViewItemSelection", target=Runtime } );
end
so that i know when the touch event ended w/o actually scrolling, which means it was just a button/item selection touch event.
back in my code
local scrollViewItemSelection = function(e)
if activeBtn ~= nil then
print("button " .. activeBtn.id .. " pressed");
activeBtn = nil;
end
end
it’s late and i’m not sure if i’m explaining this correct, or this solution is even ideal… but it works for me
[import]uid: 107352 topic_id: 18241 reply_id: 73055[/import]
They have fixed this bug, we are just waiting for it to appear in the daily builds. [import]uid: 58885 topic_id: 18241 reply_id: 74694[/import]