Dialogs

Hi everyone!

I wonder if Corona will bring us a new widget: dialogs, where it shows to the user to answer “Yes”, “No”, “Cancel” and so on.

For example, I would like to use when an user press the button “Cancel”; then, a dialog will show two options: “Yes” or “No” with the appropriate text: “Would you like to exit the application?” and a caption, obviously. It should be desired with L&F options (such themes, button styles, etc.)

If current version supports dialogs, any help would be welcome to show how to use them. I can’t find under the current doc. 

Best regards. Cordially,

Abelardo. :slight_smile:

Our native.showAlert() API lets you customize the buttons to show and it supports executing code when the buttons are selected. You could so something like (untested code, may have errors)

local function exitAppListener( event )     if event.action == "clicked" then          if event.index == 1 then             native.requestExit()         end     end end native.showAlert("App Name", "Do you really want to exit?", { "Yes", "No" }, exitAppListener )

The native.showAlert() could be part of the code that handles the cancel button in your user interface.  

There is also a community plugin called Toast that lets you do more custom alerts that you might want to look into.

Rob

Our native.showAlert() API lets you customize the buttons to show and it supports executing code when the buttons are selected. You could so something like (untested code, may have errors)

local function exitAppListener( event )     if event.action == "clicked" then          if event.index == 1 then             native.requestExit()         end     end end native.showAlert("App Name", "Do you really want to exit?", { "Yes", "No" }, exitAppListener )

The native.showAlert() could be part of the code that handles the cancel button in your user interface.  

There is also a community plugin called Toast that lets you do more custom alerts that you might want to look into.

Rob