AlertDialog Event.COMPLETE

From GiderosMobile
Revision as of 04:57, 4 January 2020 by MoKaLux (talk | contribs) (added example because imho it was needed here)

This event is dispatched when user presses any button on AlertDialog or the dialog is dismissed by any other reason.

Event.COMPLETE = "complete"

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.