Difference between revisions of "TextInputDialog"

(Methods)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
 
 
<!-- GIDEROSOBJ:TextInputDialog -->
 
<!-- GIDEROSOBJ:TextInputDialog -->
 +
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
 
'''<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> ===
+
=== Description ===
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 '''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>Examples</translate> ===
+
=== Example ===
 
<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")
Line 26: Line 27:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
[[Special:MyLanguage/TextInputDialog.new|TextInputDialog.new]] <br/>
+
[[Special:MyLanguage/TextInputDialog.new|TextInputDialog.new]] ''Creates an input dialog'' <br/>
<!-- GIDEROSMTD:TextInputDialog.new(title,message,text,cancelButton,button1,button2) -->
+
<!-- GIDEROSMTD:TextInputDialog.new(title,message,text,cancelButton,button1,button2) Creates an input dialog -->
[[Special:MyLanguage/TextInputDialog:getInputType|TextInputDialog:getInputType]] <br/>
+
[[Special:MyLanguage/TextInputDialog:getInputType|TextInputDialog:getInputType]] ''Gets the input type'' <br/>
<!-- GIDEROSMTD:TextInputDialog:getInputType() -->
+
<!-- GIDEROSMTD:TextInputDialog:getInputType() Gets the input type -->
[[Special:MyLanguage/TextInputDialog:getText|TextInputDialog:getText]] <br/>
+
[[Special:MyLanguage/TextInputDialog:getText|TextInputDialog:getText]] ''Retrieve the entered text'' <br/>
<!-- GIDEROSMTD:TextInputDialog:getText() -->
+
<!-- GIDEROSMTD:TextInputDialog:getText() Retrieve the entered text -->
[[Special:MyLanguage/TextInputDialog:isSecureInput|TextInputDialog:isSecureInput]] <br/>
+
[[Special:MyLanguage/TextInputDialog:isSecureInput|TextInputDialog:isSecureInput]] ''Check if this dialog is secure (password)'' <br/>
<!-- GIDEROSMTD:TextInputDialog:isSecureInput() -->
+
<!-- GIDEROSMTD:TextInputDialog:isSecureInput() Check if this dialog is secure (password) -->
[[Special:MyLanguage/TextInputDialog:setInputType|TextInputDialog:setInputType]] <br/>
+
[[Special:MyLanguage/TextInputDialog:setInputType|TextInputDialog:setInputType]] ''Specify the type of input'' <br/>
<!-- GIDEROSMTD:TextInputDialog:setInputType(type) -->
+
<!-- GIDEROSMTD:TextInputDialog:setInputType(type) Specify the type of input -->
[[Special:MyLanguage/TextInputDialog:setSecureInput|TextInputDialog:setSecureInput]] <br/>
+
[[Special:MyLanguage/TextInputDialog:setSecureInput|TextInputDialog:setSecureInput]] ''Instruct the dialog the secure the input'' <br/>
<!-- GIDEROSMTD:TextInputDialog:setSecureInput(secureInput) -->
+
<!-- GIDEROSMTD:TextInputDialog:setSecureInput(secureInput) Instruct the dialog the secure the input -->
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <br/>
+
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] ''Sets the input text'' <br/>
<!-- GIDEROSMTD:TextInputDialog:setText(text) -->
+
<!-- GIDEROSMTD:TextInputDialog:setText(text) Sets the input text -->
  
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 +
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
<!--[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>-->
 
<!--[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>-->

Latest revision as of 09:27, 8 January 2021


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.

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

Methods

TextInputDialog.new Creates an input dialog
TextInputDialog:getInputType Gets the input type
TextInputDialog:getText Retrieve the entered text
TextInputDialog:isSecureInput Check if this dialog is secure (password)
TextInputDialog:setInputType Specify the type of input
TextInputDialog:setSecureInput Instruct the dialog the secure the input
TextInputDialog:setText Sets the input text

Events

TextInputDialog_Event.COMPLETE

Constants

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