I have a weird situation with widgets. If I touch the titlebar (tabBar), the objects in scrollView receives touch events. So scrollView scrolls up or a button in the scrollview gets touch event. Whatever is behind the titlebar behaves like this. I saw someone else posted similar message, but I cannot find it now. [import]uid: 19297 topic_id: 21877 reply_id: 321877[/import]
You can prevent objects from leaking touches by adding a touch listener that returns true. Here’s an example (assuming tabBar is your tabBar object):
local function disableTouchLeak() return true; endtabBar:addEventListener( "touch", disableTouchLeak[/code] [import]uid: 52430 topic_id: 21877 reply_id: 86963[/import]
Hi Jonathan,
I tried similar code before, but it did not work Here is what I wrote now, but it does not work as well. I even tried for both “tap” and “touch” events.
[code]
local appToolbar = newTabBar{
top=display.statusBarHeight,
height = toolbarHeight,
gradient = toolbarGradient,
bottomFill = { 12, 16, 17, 0 },
}
appToolbar.name = “appToolbar”
local function disableTouchLeak()
return true;
end
appToolbar:addEventListener( “tap”, disableTouchLeak )
appToolbar:addEventListener( “touch”, disableTouchLeak )
[/code] [import]uid: 19297 topic_id: 21877 reply_id: 86998[/import]
I have a similar problem with a table view sitting below a tabBar acting as the top title bar. It has a couple of buttons sitting on top of it.
In my case, if I’m not scrolled, i.e. y=0 then my buttons sitting on top of the tabBar works.
If I’m scrolled at all, the tap event on the buttons passes through to the table view.
I’m returning true and I tried Jonathan’s suggestion, but the event is skipping my buttons and making it to the background. Its almost like the scrolled tableview is sitting on top of the tabbar and buttons behind the mask.
The above technique didn’t work initially. What I did get to work was I put a :toFront() on my tab bar, and on the two buttons that sat on top of it. I didn’t take the code above out, so it might be grabbing something, but the :toFront() on my buttons may have done it, or the combination of the two. [import]uid: 19626 topic_id: 21877 reply_id: 87007[/import]
>> “In my case, if I’m not scrolled, i.e. y=0 then my buttons sitting on top of the tabBar works.”
That is exactly my problem as well. Button works only when pressed twice with scrollView scrolled up. First time, the scrollView scrolls down and then the 2nd time, the button functions properly. [import]uid: 19297 topic_id: 21877 reply_id: 87011[/import]
It looks like part of the problem has been resolved in build 751. BUT the buttons still do not behave properly until the tableview is scrolled down. [import]uid: 19297 topic_id: 21877 reply_id: 88650[/import]
I think I found a workaround:
If the tableview is inserted into the view before the buttons are placed, it works perfectly. [import]uid: 19297 topic_id: 21877 reply_id: 88653[/import]