Difference between revisions of "AlertDialog"

From GiderosMobile
(→‎Examples: fix quote HTML tags)
(creating category test)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
 
<languages />
 
<languages />
 +
 
<!-- 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/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate><br />
+
<translate>The [[Special:MyLanguage/AlertDialog|AlertDialog]] class is used to display native alert dialogs with one, two or three buttons.
The [[Special:MyLanguage/AlertDialog|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 />
+
 
it&#039;s dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.<br />
+
Cancel button is mandatory but other two buttons are optional.
 +
 
 +
When the user presses any button in the alert dialog, it's dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.
 +
<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/>
 
<br />
 
<br />
 +
</translate>
  
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 /></translate>
 
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
'''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:show()
 +
</source>
 +
<br/>
  
alertDialog:addEventListener(Event.COMPLETE, onComplete)
 
alertDialog:show()</source>
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
Line 32: Line 44:
 
[[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/><!-- GIDEROSMTD:AlertDialog:show()  -->
 
[[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/><!-- GIDEROSMTD:AlertDialog:show()  -->
 
| 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> ===
 +
 
|}
 
|}
 +
 +
 +
[[Category:Main API]]

Revision as of 07:14, 2 December 2019



Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
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.

Examples

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

AlertDialog.new
AlertDialog:hide
AlertDialog:show

Events

Event.COMPLETE

Constants