Difference between revisions of "TextInputDialog"
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/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's dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.<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's dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.<br /> | ||
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.<br /></translate> | 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.<br /></translate> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Example'''<br/> | '''Example'''<br/> | ||
<source lang="lua">local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK") | <source lang="lua">local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK") | ||
Line 18: | Line 18: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
[[Special:MyLanguage/TextInputDialog.new|TextInputDialog.new]] <br/> | [[Special:MyLanguage/TextInputDialog.new|TextInputDialog.new]] <br/> | ||
[[Special:MyLanguage/TextInputDialog:getInputType|TextInputDialog:getInputType]] <br/> | [[Special:MyLanguage/TextInputDialog:getInputType|TextInputDialog:getInputType]] <br/> | ||
Line 27: | Line 27: | ||
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <br/> | [[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <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> === |
[[Special:MyLanguage/TextInputDialog.EMAIL|TextInputDialog.EMAIL]]<br/> | [[Special:MyLanguage/TextInputDialog.EMAIL|TextInputDialog.EMAIL]]<br/> | ||
[[Special:MyLanguage/TextInputDialog.NUMBER|TextInputDialog.NUMBER]]<br/> | [[Special:MyLanguage/TextInputDialog.NUMBER|TextInputDialog.NUMBER]]<br/> |
Revision as of 07:29, 24 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2012.8
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's 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()