Difference between revisions of "TextInputDialog"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(11 intermediate revisions by 3 users 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/>
+
'''Supported platforms:''' [[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/>
+
'''Available since:''' Gideros 2012.8<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/AlertDialog|AlertDialog]]<br/>
+
'''Inherits from:''' [[AlertDialog]]<br/>
=== <translate>Description</translate> ===
+
 
<translate><br />
+
=== 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&#039;s dismissed and [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event is dispatched.<br />
+
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 '''[[TextInputDialog_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.<br /></translate>
+
 
=== <translate>Examples</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.
'''Example'''<br/>
+
 
<source lang="lua">local textInputDialog = TextInputDialog.new(&quot;my title&quot;, &quot;my message&quot;, &quot;some text&quot;, &quot;Cancel&quot;, &quot;OK&quot;)
+
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
local textInputDialog = TextInputDialog.new("my title", "my message", "some text", "Cancel", "OK")
  
 
local function onComplete(event)
 
local function onComplete(event)
Line 18: Line 19:
  
 
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
 
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
textInputDialog:show()</source>
+
textInputDialog:show()
 +
</syntaxhighlight>
 +
 
 +
=== See also ===
 +
'''[[AlertDialog]]'''
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/TextInputDialog.new|TextInputDialog.new]] <br/><!-- GIDEROSMTD:TextInputDialog.new -->
+
[[TextInputDialog.new]] ''creates an input dialog''<br/><!--GIDEROSMTD:TextInputDialog.new(title,message,text,cancelButton,button1,button2) creates an input dialog-->
[[Special:MyLanguage/TextInputDialog:getInputType|TextInputDialog:getInputType]] <br/><!-- GIDEROSMTD:TextInputDialog:getInputType -->
+
 
[[Special:MyLanguage/TextInputDialog:getText|TextInputDialog:getText]] <br/><!-- GIDEROSMTD:TextInputDialog:getText -->
+
[[TextInputDialog:getInputType]] ''gets the input type''<br/><!--GIDEROSMTD:TextInputDialog:getInputType() gets the input type-->
[[Special:MyLanguage/TextInputDialog:isSecureInput|TextInputDialog:isSecureInput]] <br/><!-- GIDEROSMTD:TextInputDialog:isSecureInput -->
+
[[TextInputDialog:getText]] ''retrieves the entered text''<br/><!--GIDEROSMTD:TextInputDialog:getText() retrieves the entered text-->
[[Special:MyLanguage/TextInputDialog:setInputType|TextInputDialog:setInputType]] <br/><!-- GIDEROSMTD:TextInputDialog:setInputType -->
+
[[TextInputDialog:isSecureInput]] ''checks if this dialog is secure (password)''<br/><!--GIDEROSMTD:TextInputDialog:isSecureInput() checks if this dialog is secure (password)-->
[[Special:MyLanguage/TextInputDialog:setSecureInput|TextInputDialog:setSecureInput]] <br/><!-- GIDEROSMTD:TextInputDialog:setSecureInput -->
+
[[TextInputDialog:setInputType]] ''specifies the type of input''<br/><!--GIDEROSMTD:TextInputDialog:setInputType(type) specifies the type of input-->
[[Special:MyLanguage/TextInputDialog:setText|TextInputDialog:setText]] <br/><!-- GIDEROSMTD:TextInputDialog:setText -->
+
[[TextInputDialog:setSecureInput]] ''instructs the dialog to secure the input''<br/><!--GIDEROSMTD:TextInputDialog:setSecureInput(secureInput) instructs the dialog to secure the input-->
 +
[[TextInputDialog:setText]] ''sets the input text''<br/><!--GIDEROSMTD:TextInputDialog:setText(text) sets the input text-->
 +
 
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
+
 
[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/><!-- GIDEROSEVT:Event.COMPLETE -->
+
=== Events ===
=== <translate>Constants</translate> ===
+
<!--[[Event.COMPLETE]]<br/>-->
[[Special:MyLanguage/TextInputDialog.EMAIL|TextInputDialog.EMAIL]]<br/><!-- GIDEROSCST:TextInputDialog.EMAIL -->
+
[[TextInputDialog_Event.COMPLETE]]<br/><!--GIDEROSEVT:Event.COMPLETE complete-->
[[Special:MyLanguage/TextInputDialog.NUMBER|TextInputDialog.NUMBER]]<br/><!-- GIDEROSCST:TextInputDialog.NUMBER -->
+
=== Constants ===
[[Special:MyLanguage/TextInputDialog.PHONE|TextInputDialog.PHONE]]<br/><!-- GIDEROSCST:TextInputDialog.PHONE -->
+
[[TextInputDialog.EMAIL]]<br/><!--GIDEROSCST:TextInputDialog.EMAIL email-->
[[Special:MyLanguage/TextInputDialog.TEXT|TextInputDialog.TEXT]]<br/><!-- GIDEROSCST:TextInputDialog.TEXT -->
+
[[TextInputDialog.NUMBER]]<br/><!--GIDEROSCST:TextInputDialog.NUMBER number-->
[[Special:MyLanguage/TextInputDialog.URL|TextInputDialog.URL]]<br/><!-- GIDEROSCST:TextInputDialog.URL -->
+
[[TextInputDialog.PHONE]]<br/><!--GIDEROSCST:TextInputDialog.PHONE phone-->
 +
[[TextInputDialog.TEXT]]<br/><!--GIDEROSCST:TextInputDialog.TEXT text-->
 +
[[TextInputDialog.URL]]<br/><!--GIDEROSCST:TextInputDialog.URL url-->
 
|}
 
|}
 +
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 14:33, 13 July 2023

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

See also

AlertDialog

Methods

TextInputDialog.new creates an input dialog

TextInputDialog:getInputType gets the input type
TextInputDialog:getText retrieves the entered text
TextInputDialog:isSecureInput checks if this dialog is secure (password)
TextInputDialog:setInputType specifies the type of input
TextInputDialog:setSecureInput instructs the dialog to secure the input
TextInputDialog:setText sets the input text

Events

TextInputDialog_Event.COMPLETE

Constants

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