Difference between revisions of "AlertDialog"
From GiderosMobile
m |
(added description to methods as well as gideros tags) |
||
Line 7: | Line 7: | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | The | + | 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. | Cancel button is mandatory but other two buttons are optional. | ||
Line 15: | Line 15: | ||
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. | 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. | ||
− | === <translate> | + | === <translate>Example</translate> === |
<source lang="lua"> | <source lang="lua"> | ||
local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No") | local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No") | ||
Line 28: | Line 28: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Methods</translate> === | === <translate>Methods</translate> === | ||
− | [[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] <br/><!-- GIDEROSMTD:AlertDialog.new(title,message,cancelButton,button1,button2) | + | [[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] ''creates a new AlertDialog object''<br/> |
− | [[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] <br/><!-- GIDEROSMTD:AlertDialog:hide() | + | <!-- GIDEROSMTD:AlertDialog.new(title,message,cancelButton,button1,button2) Creates a new AlertDialog object --> |
− | [[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/><!-- GIDEROSMTD:AlertDialog:show() | + | [[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] ''hides the alert dialog''<br/> |
+ | <!-- GIDEROSMTD:AlertDialog:hide() Hides the alert dialog --> | ||
+ | [[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] ''shows the alert dialog''<br/> | ||
+ | <!-- GIDEROSMTD:AlertDialog:show() Shows the alert dialog --> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
− | [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/><!-- GIDEROSEVT:Event.COMPLETE complete--> | + | [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/> |
+ | <!-- GIDEROSEVT:Event.COMPLETE complete --> | ||
=== <translate>Constants</translate> === | === <translate>Constants</translate> === | ||
− | |||
|} | |} |
Revision as of 04:41, 4 January 2020
Supported platforms:
Available since: Gideros 2012.8
Inherits from: Object
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.
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()
MethodsAlertDialog.new creates a new AlertDialog object |
EventsConstants |