Difference between revisions of "AlertDialog"
From GiderosMobile
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | ||
<!-- GIDEROSOBJ:AlertDialog --> | <!-- GIDEROSOBJ:AlertDialog --> | ||
+ | |||
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | '''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | ||
'''<translate>Available since</translate>:''' Gideros 2012.8<br/> | '''<translate>Available since</translate>:''' Gideros 2012.8<br/> | ||
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | '''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/> | ||
− | === | + | === Description === |
The AlertDialog class is used to display native alert dialogs with one, two or three buttons. | The AlertDialog class is used to display native alert dialogs with one, two or three buttons. | ||
Line 13: | Line 14: | ||
When the user presses any button in the alert dialog, it's dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched. | When the user presses any button in the alert dialog, it's dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched. | ||
− | If alert dialog is dismissed by any other means ( | + | If alert dialog is dismissed by any other means (pressing back button on Android or pressing close button on desktop), it behaves as cancel button pressed. |
− | === | + | === Example === |
<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 30: | Line 31: | ||
[[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] ''creates a new AlertDialog object''<br/> | [[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] ''creates a new AlertDialog object''<br/> | ||
<!-- GIDEROSMTD:AlertDialog.new(title,message,cancelButton,button1,button2) Creates a new AlertDialog object --> | <!-- GIDEROSMTD:AlertDialog.new(title,message,cancelButton,button1,button2) Creates a new AlertDialog object --> | ||
+ | |||
[[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] ''hides the alert dialog''<br/> | [[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] ''hides the alert dialog''<br/> | ||
<!-- GIDEROSMTD:AlertDialog:hide() Hides the alert dialog --> | <!-- GIDEROSMTD:AlertDialog:hide() Hides the alert dialog --> |
Revision as of 03:14, 11 February 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 (pressing back button on Android or pressing close button on desktop), it behaves as cancel button 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 AlertDialog:hide hides the alert dialog |
EventsConstants |