native.showAlert does not seem to work

Hi,

In the Release note for version 2018.3288, what does the following line means :

  • HTML5: native.showAlert() is based now on the Dialog html5 element

And the following line of code does not seem to work (testing with Chrome):

native.showAlert (“Corona”, “Native showAlert dialog”, {“Yes”, “No”})

Enclosed a screenshot.

nativeShowAlert.png

Show alert in Chrome will either be blocked or only show part of the info you pass.

I’m not sure if this is a known issue or not.  You might need to file a bug, but I’d wait to see if the staff answer back with more details on how this should work.

Update : I don’t see a listener.  This may be optional in typical usage, but I’d rule out the missing listener (in your sample) as an cause of the issue by passing one in.  It is probably fine, but just in case…

  • “HTML5: native.showAlert() is based now on the Dialog html5 element”
  • It means native.showAlert() now uses JS Dialog Box instead of JS alert() function.

native.showAlert() displays only title and message for now, buttons are not handled yet … they will be implemented soon

Implemented [, buttonLabels [, listener]] … It should work with coming daily build

Hi,

tested with versions 2018.3297 and 2018.3301. Buttons labels displayed correctly but the window app does not respond as soon as a button label is clicked.

​For example take the composer sample project and add a native.showAlert in the showmen function of scene1.lua.

function scene:show( event ) local phase = event.phase if "did" == phase then print( "1: show event, phase did" ) -- remove previous scene's view composer.removeScene( "scene4" ) -- Update Lua memory text display local showMem = function() image:addEventListener( "touch", image ) text3.isVisible = true text2.text = text2.text .. string.format("%.2g", collectgarbage("count")/1000) .. "MB" text2.x = display.contentWidth \* 0.5 native.showAlert ("Composer Sample", "Test showAlert", {"Ok"}) end memTimer = timer.performWithDelay( 1000, showMem, 1 ) end end

When I click on Ok, touch events no longer respond.

I am testing on Chrome  Version 66.0.3359.181

Regards,

Lourenço.

Fixed… On close, showAlert() should return focus to launching element.

Show alert in Chrome will either be blocked or only show part of the info you pass.

I’m not sure if this is a known issue or not.  You might need to file a bug, but I’d wait to see if the staff answer back with more details on how this should work.

Update : I don’t see a listener.  This may be optional in typical usage, but I’d rule out the missing listener (in your sample) as an cause of the issue by passing one in.  It is probably fine, but just in case…

  • “HTML5: native.showAlert() is based now on the Dialog html5 element”
  • It means native.showAlert() now uses JS Dialog Box instead of JS alert() function.

native.showAlert() displays only title and message for now, buttons are not handled yet … they will be implemented soon

Implemented [, buttonLabels [, listener]] … It should work with coming daily build

Hi,

tested with versions 2018.3297 and 2018.3301. Buttons labels displayed correctly but the window app does not respond as soon as a button label is clicked.

​For example take the composer sample project and add a native.showAlert in the showmen function of scene1.lua.

function scene:show( event ) local phase = event.phase if "did" == phase then print( "1: show event, phase did" ) -- remove previous scene's view composer.removeScene( "scene4" ) -- Update Lua memory text display local showMem = function() image:addEventListener( "touch", image ) text3.isVisible = true text2.text = text2.text .. string.format("%.2g", collectgarbage("count")/1000) .. "MB" text2.x = display.contentWidth \* 0.5 native.showAlert ("Composer Sample", "Test showAlert", {"Ok"}) end memTimer = timer.performWithDelay( 1000, showMem, 1 ) end end

When I click on Ok, touch events no longer respond.

I am testing on Chrome  Version 66.0.3359.181

Regards,

Lourenço.

Fixed… On close, showAlert() should return focus to launching element.