Difference between revisions of "AlertDialog"

From GiderosMobile
Line 2: Line 2:
 
'''Supported platforms:''' android, ios, mac, pc<br/>
 
'''Supported platforms:''' android, ios, mac, pc<br/>
 
'''Available since:''' Gideros 2012.8<br/>
 
'''Available since:''' Gideros 2012.8<br/>
=== Description ===
+
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />
 
The [[Special:MyLanguage/AlertDialog|AlertDialog]] class is used to display native alert dialogs with one, two or three buttons. Cancel button<br />
 
The [[Special:MyLanguage/AlertDialog|AlertDialog]] class is used to display native alert dialogs with one, two or three buttons. Cancel button<br />
Line 11: Line 11:
 
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 /></translate>
 
<br /></translate>
=== Examples ===
+
=== <translate>Examples</translate> ===
 
'''Example'''<br/>
 
'''Example'''<br/>
 
<source lang="lua">local alertDialog = AlertDialog.new(&quot;This is my title&quot;, &quot;And my message&quot;, &quot;Cancel&quot;, &quot;Yes&quot;, &quot;No&quot;)
 
<source lang="lua">local alertDialog = AlertDialog.new(&quot;This is my title&quot;, &quot;And my message&quot;, &quot;Cancel&quot;, &quot;Yes&quot;, &quot;No&quot;)
Line 23: Line 23:
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== Methods ===
+
=== <translate>Methods</translate> ===
 
[[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] <br/>
 
[[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] <br/>
 
[[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] <br/>
 
[[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] <br/>
 
[[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/>
 
[[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/>
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== Events ===
+
=== <translate>Events</translate> ===
 
[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>
 
[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>
=== Constants ===
+
=== <translate>Constants</translate> ===
 
|}
 
|}

Revision as of 08:28, 24 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(&quot;This is my title&quot;, &quot;And my message&quot;, &quot;Cancel&quot;, &quot;Yes&quot;, &quot;No&quot;)

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