Difference between revisions of "TextInputDialog"
From GiderosMobile
Line 7: | Line 7: | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> | ||
− | The [[Special:MyLanguage/TextInputDialog|TextInputDialog]] class is used to display native text input dialogs with one text edit field, one button (as cancel button) and two optional buttons. When the user presses any buttons in the alert dialog, it | + | The [[Special:MyLanguage/TextInputDialog|TextInputDialog]] class is used to display native text input dialogs with one text edit field, one button (as cancel button) and two optional buttons. When the user presses any buttons in the alert dialog, it is dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched. |
− | If text input 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. | + | |
+ | |||
+ | If text input 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.</translate> | ||
+ | |||
+ | |||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
− | <source lang="lua">local textInputDialog = TextInputDialog.new( | + | <source lang="lua">local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK") |
local function onComplete(event) | local function onComplete(event) |
Revision as of 15:39, 26 June 2019
Supported platforms:
Available since: Gideros 2012.8
Inherits from: AlertDialog
Description
The TextInputDialog class is used to display native text input dialogs with one text edit field, one button (as cancel button) and two optional buttons. When the user presses any buttons in the alert dialog, it is dismissed and Event.COMPLETE event is dispatched.
If text input 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 textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK")
local function onComplete(event)
print(event.text, event.buttonIndex, event.buttonText)
end
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
textInputDialog:show()