Difference between revisions of "AlertDialog Event.COMPLETE"
From GiderosMobile
(added example because imho it was needed here) |
(revamped the page) |
||
Line 1: | Line 1: | ||
− | < | + | <languages /> |
+ | '''<translate>Available since</translate>:''' Gideros 2012.8<br/> | ||
+ | '''<translate>Value</translate>:''' complete<br/> | ||
+ | '''<translate>Defined by</translate>:''' [[Special:MyLanguage/AlertDialog|AlertDialog]]<br/> | ||
+ | |||
+ | === <translate>Description</translate> === | ||
This event is dispatched when user presses any button on AlertDialog or the dialog is dismissed by any other reason. | This event is dispatched when user presses any button on AlertDialog or the dialog is dismissed by any other reason. | ||
− | |||
− | |||
− | |||
− | |||
=== <translate>Example</translate> === | === <translate>Example</translate> === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | local alertDialog = AlertDialog.new("Title", "Message", " | + | local alertDialog = AlertDialog.new("Title", "Message", "CANCEL", "YES", "NO") |
local function onComplete(event) | local function onComplete(event) | ||
Line 18: | Line 19: | ||
</source> | </source> | ||
− | === Event properties | + | === Event properties === |
'''buttonIndex:''' (number) the index of the button pressed. ''nil'' when Cancel button is pressed, ''1'' when 1st button is pressed and, ''2'' when 2nd button is pressed.<br/> | '''buttonIndex:''' (number) the index of the button pressed. ''nil'' when Cancel button is pressed, ''1'' when 1st button is pressed and, ''2'' when 2nd button is pressed.<br/> | ||
'''buttonText:''' (string) the text of the button pressed. | '''buttonText:''' (string) the text of the button pressed. | ||
+ | |||
{{AlertDialog}} | {{AlertDialog}} | ||
+ | |||
+ | <!--[[Category: AlertDialog]]--> |
Revision as of 05:25, 4 January 2020
Available since: Gideros 2012.8
Value: complete
Defined by: AlertDialog
Description
This event is dispatched when user presses any button on AlertDialog or the dialog is dismissed by any other reason.
Example
local alertDialog = AlertDialog.new("Title", "Message", "CANCEL", "YES", "NO")
local function onComplete(event)
print(event.buttonIndex, event.buttonText)
end
alertDialog:addEventListener(Event.COMPLETE, onComplete)
alertDialog:show()
Event properties
buttonIndex: (number) the index of the button pressed. nil when Cancel button is pressed, 1 when 1st button is pressed and, 2 when 2nd button is pressed.
buttonText: (string) the text of the button pressed.