Difference between revisions of "TextInputDialog"

From GiderosMobile
Line 5: Line 5:
 
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
 
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
 
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/AlertDialog|AlertDialog]]<br/>
 
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/AlertDialog|AlertDialog]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<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 is dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.
 
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/>
+
<source lang="lua">
<source lang="lua">local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK")
+
local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK")
  
 
local function onComplete(event)
 
local function onComplete(event)
Line 22: Line 20:
  
 
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
 
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
textInputDialog:show()</source>
+
textInputDialog:show()
 +
</source>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
Line 33: Line 33:
 
[[Special:MyLanguage/TextInputDialog:setSecureInput|TextInputDialog:setSecureInput]] <br/><!-- GIDEROSMTD:TextInputDialog:setSecureInput(secureInput)  -->
 
[[Special:MyLanguage/TextInputDialog:setSecureInput|TextInputDialog:setSecureInput]] <br/><!-- GIDEROSMTD:TextInputDialog:setSecureInput(secureInput)  -->
 
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <br/><!-- GIDEROSMTD:TextInputDialog:setText(text)  -->
 
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <br/><!-- GIDEROSMTD:TextInputDialog:setText(text)  -->
 +
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
Line 43: Line 44:
 
[[Special:MyLanguage/TextInputDialog.URL|TextInputDialog.URL]]<br/><!-- GIDEROSCST:TextInputDialog.URL url-->
 
[[Special:MyLanguage/TextInputDialog.URL|TextInputDialog.URL]]<br/><!-- GIDEROSCST:TextInputDialog.URL url-->
 
|}
 
|}
 
{{TextInputDialog}}
 

Revision as of 00:16, 10 December 2019


Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
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

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()

Methods

TextInputDialog.new
TextInputDialog:getInputType
TextInputDialog:getText
TextInputDialog:isSecureInput
TextInputDialog:setInputType
TextInputDialog:setSecureInput
TextInputDialog:setText

Events

Event.COMPLETE

Constants

TextInputDialog.EMAIL
TextInputDialog.NUMBER
TextInputDialog.PHONE
TextInputDialog.TEXT
TextInputDialog.URL