Difference between revisions of "AlertDialog"
From GiderosMobile
Line 3: | Line 3: | ||
'''Available since:''' Gideros 2012.8<br/> | '''Available since:''' Gideros 2012.8<br/> | ||
=== Description === | === Description === | ||
− | <br /> | + | <translate><br /> |
− | The | + | The [[[AlertDialog]]] class is used to display native alert dialogs with one, two or three buttons. Cancel button<br /> |
is mandatory but other two buttons are optional. When the user presses any button in the alert dialog,<br /> | is mandatory but other two buttons are optional. When the user presses any button in the alert dialog,<br /> | ||
− | it's dismissed and | + | it's dismissed and [[[Event.COMPLETE]]] event is dispatched.<br /> |
<br /> | <br /> | ||
If alert dialog is dismissed by any other means (by pressing back button on Android or by pressing close button on desktop), it behaves as cancel button is pressed.<br /> | If alert dialog is dismissed by any other means (by pressing back button on Android or by pressing close button on desktop), it behaves as cancel button is pressed.<br /> | ||
− | <br /> | + | <br /></translate> |
=== Examples === | === Examples === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
− | <source lang="lua">local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No") | + | <source lang="lua">local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No") |
− | + | ||
− | local function onComplete(event) | + | local function onComplete(event) |
− | print(event.buttonIndex, event.buttonText) | + | print(event.buttonIndex, event.buttonText) |
− | end | + | end |
− | + | ||
− | alertDialog:addEventListener(Event.COMPLETE, onComplete) | + | alertDialog:addEventListener(Event.COMPLETE, onComplete) |
alertDialog:show()</source> | alertDialog:show()</source> | ||
{|- | {|- |
Revision as of 13:49, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2012.8
Description
The [[[AlertDialog]]] class is used to display native alert dialogs with one, two or three buttons. Cancel button
is mandatory but other two buttons are optional. When the user presses any button in the alert dialog,
it's dismissed and [[[Event.COMPLETE]]] event is dispatched.
If alert dialog is dismissed by any other means (by pressing back button on Android or by pressing close button on desktop), it behaves as cancel button is pressed.
Examples
Example
local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No")
local function onComplete(event)
print(event.buttonIndex, event.buttonText)
end
alertDialog:addEventListener(Event.COMPLETE, onComplete)
alertDialog:show()
Methods |
EventsConstants |