Difference between revisions of "TextInputDialog:setInputType"

From GiderosMobile
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2012.8<br/>
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
+
'''Class:''' [[TextInputDialog]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/TextInputDialog|TextInputDialog]]<br/>
 
  
=== <translate>Description</translate> ===
+
=== Description ===
<translate>
+
Mostly used on mobile devices. Sets the input (keyboard) type associated with the text field.
Sets the input (keyboard) type associated with the text field. The options are:
+
<syntaxhighlight lang="lua">
<ul>
+
TextInputDialog:setInputType(type)
<li>[[Special:MyLanguage/TextInputDialog.TEXT|TextInputDialog.TEXT]]: Default keyboard type</li>
+
</syntaxhighlight>
<li>[[Special:MyLanguage/TextInputDialog.NUMBER|TextInputDialog.NUMBER]]: Numeric keypad</li>
+
 
<li>[[Special:MyLanguage/TextInputDialog.PHONE|TextInputDialog.PHONE]]: Keypad designed for entering telephone numbers</li>
+
The options are:
<li>[[Special:MyLanguage/TextInputDialog.EMAIL|TextInputDialog.EMAIL]]: Keyboard optimized for specifying email addresses</li>
+
*[[TextInputDialog.TEXT]]: default keyboard type
<li>[[Special:MyLanguage/TextInputDialog.URL|TextInputDialog.URL]]: Keyboard optimized for URL entry</li>
+
*[[TextInputDialog.NUMBER]]: numeric keypad
</ul>
+
*[[TextInputDialog.PHONE]]: keypad designed for entering telephone numbers
</translate>
+
*[[TextInputDialog.EMAIL]]: keyboard optimized for specifying email addresses
 +
*[[TextInputDialog.URL]]: keyboard optimized for URL entry
 +
 
 +
=== Parameters ===
 +
'''type''': (string) input type associated with the text field<br/>
  
 +
=== Example ===
 +
'''Mobile'''
 +
<syntaxhighlight lang="lua">
 +
local textInputDialog = TextInputDialog.new("my title", "my message", 360, "Cancel", "OK")
 +
textInputDialog:setInputType(TextInputDialog.NUMBER) -- or "number"
  
<source lang="lua">
+
local function onComplete(event)
TextInputDialog:setInputType(type)
+
print(event.text, event.buttonIndex, event.buttonText)
</source>
+
end
  
=== <translate>Parameters</translate> ===
+
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
'''type''': (string) <translate>Tnput type associated with the text field.</translate> <br/>
+
textInputDialog:show()
 +
</syntaxhighlight>
  
 
{{TextInputDialog}}
 
{{TextInputDialog}}

Latest revision as of 20:51, 4 November 2024

Available since: Gideros 2012.8
Class: TextInputDialog

Description

Mostly used on mobile devices. Sets the input (keyboard) type associated with the text field.

TextInputDialog:setInputType(type)

The options are:

Parameters

type: (string) input type associated with the text field

Example

Mobile

local textInputDialog = TextInputDialog.new("my title", "my message", 360, "Cancel", "OK")
textInputDialog:setInputType(TextInputDialog.NUMBER) -- or "number"

local function onComplete(event)
	print(event.text, event.buttonIndex, event.buttonText)
end

textInputDialog:addEventListener(Event.COMPLETE, onComplete)
textInputDialog:show()