native.cancelWebPopup() usage

I am using native.cancelWebPopup() to get rid of a webpopup but it doesn’t appear to always work.

Is there a better way? Does native.cancelWebPopup() actually completely remove the webpopup or is there some residual left over? [import]uid: 42417 topic_id: 25024 reply_id: 325024[/import]

cancelWebpopup should be working. I haven’t heard seen any reports that it’s broken. What device/simulator are you seeing the problem on? It’s always good to post some code so we can see if there is a problem.

The NativeDisplayObjects sample code (in /Interface folder) shipped with Corona demonstrates all the Native Objects (including WebPopUp) and it’s a good app to run if you think there is a problem.

Calling native.cancelWebPopup (or return false in the WebPopup listener), will remove it completely.

Tom [import]uid: 7559 topic_id: 25024 reply_id: 101648[/import]

Thanks Tom, I am (using it within storyboard) adding it on enterScene thus:

local options = { hasBackground=false, autoCancel=false, baseUrl=system.ResourceDirectory } native.showWebPopup( 0, gettopnavY, display.contentWidth, gettherealheight, theurlstring, options )
and (using it within storyboard) removing it on exitScene thus:

native.cancelWebPopup()

It doesn’t always remove it for some reason and leaves the webpopup overlayed on my scenes (when going to another scene) [import]uid: 42417 topic_id: 25024 reply_id: 101650[/import]

First you need to see if it’s calling the cancel code when it should. I would add a print statement before calling native.cancelWebPopup so you know it’s getting there.

Tom [import]uid: 7559 topic_id: 25024 reply_id: 101653[/import]

Agreed. I have a print statement print( "2: exitScene event" )

And it does indeed print out properly each time.

updated: it was not printing out properly.

The culprit:

[code]function scene:exitScene()

print( “thescene: exitScene event\n” )

end[/code]

Should have been:

[code]function scene:exitScene( event )

print( “thescene: exitScene event\n” )

end[/code]

Now I really wonder if this was included in the original storyboard sample code as that is what I built off of. I know others have been saying their exitScene wasn’t firing either.

Silly oversight on my part but I had a bunch of other stuff printing so I assumed everything was ok. Never assume lol. Anyhow, glad its sorted.

Guess its not quite so simple…
My webpopups are not being cleared. Even on exitscene. And its almost intermittent. Something deeper is happening. [import]uid: 42417 topic_id: 25024 reply_id: 101656[/import]

pls ignore - was bug in my code, not in native.cancelwebpopup [import]uid: 133156 topic_id: 25024 reply_id: 102077[/import]