isModal overlay issue

Hey,

I’m simplifying the description, so if it doesn’t appear to do anything, don’t worry.

I have an overlay that closes on a touch/tap event of any kind. The scene it returns to has buttons that tigger on event.state == “release”. Even though both the overlay isModal is set to true and the overlay listener returns true, it still triggers the underlying buttons.

Anyone got any advice?

Cheers

Are you using letterbox? I’ve heard of people having problems with overlays combined with letterbox, so as a starting point perhaps comment out letterbox and see if the problem persists.

What you could do in the mean time is make a full screen, transparent “background” that is hitTestable and add touch, tap, and other handlers to it to absorb them and not pass them on. 

Cheers guys.

I’ll have a look at making that background. I’m still hoping of finding a better way to get user input before I finish this :slight_smile:

Are you using letterbox? I’ve heard of people having problems with overlays combined with letterbox, so as a starting point perhaps comment out letterbox and see if the problem persists.

What you could do in the mean time is make a full screen, transparent “background” that is hitTestable and add touch, tap, and other handlers to it to absorb them and not pass them on. 

any update on this issue?   Has Corona confirmed this as a known bug?

I’m on build 1093 and isModal does not seem to work.  Tried commenting letter box and this didn’t help.

This has been reported in the forums several times, and people have provided suggestions and work arounds for it.  I don’t know that any one has formally submitted a bug report.  It would be really useful for someone to file a bug report on this.  Create a small example that fails and use the “Report a Bug” link at the top of the page.

Thanks

Cheers guys.

I’ll have a look at making that background. I’m still hoping of finding a better way to get user input before I finish this :slight_smile:

any update on this issue?   Has Corona confirmed this as a known bug?

I’m on build 1093 and isModal does not seem to work.  Tried commenting letter box and this didn’t help.

This has been reported in the forums several times, and people have provided suggestions and work arounds for it.  I don’t know that any one has formally submitted a bug report.  It would be really useful for someone to file a bug report on this.  Create a small example that fails and use the “Report a Bug” link at the top of the page.

Thanks

Aside from this issue (which I’m getting currently), what’s the proper methodology to hide an overlay (using storyboard.hideOverlay) from within the overlay? I have an overlay the size of the entire content area and want to close it from a button belonging to the overlay. For some reason the button registers being clicked (tested via a print statement) but the overlay does not disappear.

Seems like this would be a common use case. Any insight would be appreciated.

Thx!

I hide the overlay all the time from a button on the overlay.  This should be working.  Perhaps you can post some code? 

my issue that is either the same thing I think, or closely associated was raised as Case  25818  ( http://forums.coronalabs.com/topic/38763-listener-bug-why-does-a-2nd-listener-pick-up-this-event-in-this-code/?hl=25818#entry201604 )

I’ll see about posting some code in the next couple of days but having just seen this note I should mention that the storyboard page I’m “showing” the overlay on has a scrollView widget spanning the entire content area…

I think part of the problem with this is how touch events work.  If you just “tap” (not touch, move, let up), Corona SDK generates both a series of “touch” events _ **AND** _ a “tap” event.  The touch event may get absorbed by people setting up touch handlers to catch the leaking event but they don’t set up a trap for the tap event that goes with it.  If your underlying layer has things looking to be triggered by tap’s that tap falls through.

With regards to the touch and tap handlers leaving the overlay and making it to the underlying scene:  This is without a doubt a usability bug.  It however is not a program bug.  It’s not a program bug because a scene, be it an overlay or regular scene is just a Corona SDK display.newGroup() holding display objects.  You can stack groups on top of groups and by definition, tap and touch events that are not handled by an object (and return’s true) keeps propagating through the display hierarchy.   This is an important design pattern for our apps.

Where it becomes a usability bug is that you expect your scene’s to be modal when you set the .isModal flag.   And while I’ve not seen the Storyboard 1.0 code, it’s probably trapping touch but not tap.  This is fixed in Storyboard 2.0 which is getting close.  In the mean time, you can drop both a touch and tap handler on your overlay’s background that just returns true and it should fix this for you.

Hi Rob - would be great if this workaround worked, but I’m finding it doesn’t.  Using:

workAroundRect:addEventListener("touch", blockBackgroundTouches) workAroundRect:addEventListener("tap", blockBackgroundTouches) local function blockBackgroundTouches(event)     return true end  

Remember in my case the issue is:

a) no issues if you haven’t scrolled the tableview, but

b) if you scroll the table view a bit => go to overlay => then click on overlay & return to underlying => then the tableview cell you were pressing over gets triggered when it shouldn’t

c) also can confirm in this case (from b) that in the overlay you can either “tap” or “touch” (hold it down longer) and it has the same effect of once back in the underlying screen 

d) so overall completely different thing happens (one correct, one not correct) just depending upon whether you have scrolled the table view a bit prior to going into overlay

Hi Greg.  I understand your problem, but this thread is about .isModal overlays. 

Regardless:

workAroundRect:addEventListener("touch", blockBackgroundTouches) workAroundRect:addEventListener("tap", blockBackgroundTouches) local function blockBackgroundTouches(event)     return true end

is likely not going to work because of scope issues.  When you define the touch and tap listeners, blockBackgroundTouches is undefined and therefore will try to call a nil function.  The local function… block needs to come first.

sorry - they’re in the correct order in my scene, I’d just copy/pasted them in incorrect order - anyway I’ve sidetracked the thread so sorry about that…

Aside from this issue (which I’m getting currently), what’s the proper methodology to hide an overlay (using storyboard.hideOverlay) from within the overlay? I have an overlay the size of the entire content area and want to close it from a button belonging to the overlay. For some reason the button registers being clicked (tested via a print statement) but the overlay does not disappear.

Seems like this would be a common use case. Any insight would be appreciated.

Thx!