Difference between revisions of "TextInputDialog:setInputType"

From GiderosMobile
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2012.8<br/>
 
'''Available since:''' Gideros 2012.8<br/>
 +
'''Class:''' [[TextInputDialog]]<br/>
 +
 
=== Description ===
 
=== Description ===
<translate><br />
+
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:<br />
+
<syntaxhighlight lang="lua">
<br />
+
TextInputDialog:setInputType(type)
&lt;ul&gt;<br />
+
</syntaxhighlight>
&lt;li&gt;[[TextInputDialog.TEXT]]: Default keyboard type&lt;/li&gt;<br />
+
 
&lt;li&gt;[[TextInputDialog.NUMBER]]: Numeric keypad&lt;/li&gt;<br />
+
The options are:
&lt;li&gt;[[TextInputDialog.PHONE]]: Keypad designed for entering telephone numbers&lt;/li&gt;<br />
+
*[[TextInputDialog.TEXT]]: default keyboard type
&lt;li&gt;[[TextInputDialog.EMAIL]]: Keyboard optimized for specifying email addresses&lt;/li&gt;<br />
+
*[[TextInputDialog.NUMBER]]: numeric keypad
&lt;li&gt;[[TextInputDialog.URL]]: Keyboard optimized for URL entry&lt;/li&gt;<br />
+
*[[TextInputDialog.PHONE]]: keypad designed for entering telephone numbers
&lt;/ul&gt;<br />
+
*[[TextInputDialog.EMAIL]]: keyboard optimized for specifying email addresses
<br /></translate>
+
*[[TextInputDialog.URL]]: keyboard optimized for URL entry
<source lang="lua">
+
 
TextInputDialog:setInputType(type)
 
</source>
 
 
=== Parameters ===
 
=== Parameters ===
'''type''': (string) <translate>Tnput type associated with the text field.</translate> <br/>
+
'''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"
 +
 
 +
local function onComplete(event)
 +
print(event.text, event.buttonIndex, event.buttonText)
 +
end
 +
 
 +
textInputDialog:addEventListener(Event.COMPLETE, onComplete)
 +
textInputDialog:show()
 +
</syntaxhighlight>
 +
 
 +
{{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()