Difference between revisions of "AlertDialog"

From GiderosMobile
m (Text replacement - "</source" to "</syntaxhighlight")
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<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/>
+
'''Supported platforms:''' [[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/>
+
'''Available since:''' Gideros 2012.8<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
+
'''Inherits from:''' [[Object]]<br/>
=== <translate>Description</translate> ===
 
<translate><br />
 
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 />
 
<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 />
+
=== Description ===
<br /></translate>
+
The AlertDialog class is used to display native alert dialogs with one, two or three buttons.
=== <translate>Examples</translate> ===
 
'''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;)
 
  
local function onComplete(event)
+
Cancel button is mandatory but other two buttons are optional.
print(event.buttonIndex, event.buttonText)
+
 
 +
When the user presses any button in the alert dialog, it's dismissed and '''[[AlertDialog_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 ===
 +
<syntaxhighlight lang="lua">
 +
local alertDialog = AlertDialog.new("This is my title", "And my message", "Cancel", "Yes", "No")
 +
local function onComplete(e)
 +
print(e.buttonIndex, e.buttonText)
 
end
 
end
 +
alertDialog:addEventListener(Event.COMPLETE, onComplete)
 +
alertDialog:show()
 +
</syntaxhighlight>
 +
 +
=== See also ===
 +
'''[[TextInputDialog]]'''
  
alertDialog:addEventListener(Event.COMPLETE, onComplete)
 
alertDialog:show()</source>
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/AlertDialog.new|AlertDialog.new]] <br/><!-- GIDEROSMTD:AlertDialog.new -->
+
[[AlertDialog.new]] ''creates a new AlertDialog object''<br/><!--GIDEROSMTD:AlertDialog.new(title,message,cancelButton,button1,button2) creates a new AlertDialog object-->
[[Special:MyLanguage/AlertDialog:hide|AlertDialog:hide]] <br/><!-- GIDEROSMTD:AlertDialog:hide -->
+
 
[[Special:MyLanguage/AlertDialog:show|AlertDialog:show]] <br/><!-- GIDEROSMTD:AlertDialog:show -->
+
[[AlertDialog:hide]] ''hides the alert dialog''<br/><!--GIDEROSMTD:AlertDialog:hide() hides the alert dialog-->
 +
[[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> ===
+
=== Events ===
[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/><!-- GIDEROSEVT:Event.COMPLETE -->
+
<!--[[Event.COMPLETE]]<br/>-->
=== <translate>Constants</translate> ===
+
[[AlertDialog_Event.COMPLETE]]<br/><!--GIDEROSEVT:Event.COMPLETE complete-->
 +
=== Constants ===
 
|}
 
|}
 +
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 16:59, 12 July 2023

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 AlertDialog_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(e)
	print(e.buttonIndex, e.buttonText)
end
alertDialog:addEventListener(Event.COMPLETE, onComplete)
alertDialog:show()

See also

TextInputDialog

Methods

AlertDialog.new creates a new AlertDialog object

AlertDialog:hide hides the alert dialog
AlertDialog:show shows the alert dialog

Events

AlertDialog_Event.COMPLETE

Constants