TextInputDialog:setInputType: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''Available since:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/TextInputDialog|TextInputDialog]]<br/>
'''Class:''' [[TextInputDialog]]<br/>
=== <translate>Description</translate> ===
 
<translate><br />
=== Description ===
Sets the input (keyboard) type associated with the text field. The options are:<br />
Mostly used on mobile devices. Sets the input (keyboard) type associated with the text field.
<br />
<syntaxhighlight lang="lua">
&lt;ul&gt;<br />
TextInputDialog:setInputType(type)
&lt;li&gt;[[Special:MyLanguage/TextInputDialog.TEXT|TextInputDialog.TEXT]]: Default keyboard type&lt;/li&gt;<br />
</syntaxhighlight>
&lt;li&gt;[[Special:MyLanguage/TextInputDialog.NUMBER|TextInputDialog.NUMBER]]: Numeric keypad&lt;/li&gt;<br />
 
&lt;li&gt;[[Special:MyLanguage/TextInputDialog.PHONE|TextInputDialog.PHONE]]: Keypad designed for entering telephone numbers&lt;/li&gt;<br />
The options are:
&lt;li&gt;[[Special:MyLanguage/TextInputDialog.EMAIL|TextInputDialog.EMAIL]]: Keyboard optimized for specifying email addresses&lt;/li&gt;<br />
*[[TextInputDialog.TEXT]]: default keyboard type
&lt;li&gt;[[Special:MyLanguage/TextInputDialog.URL|TextInputDialog.URL]]: Keyboard optimized for URL entry&lt;/li&gt;<br />
*[[TextInputDialog.NUMBER]]: numeric keypad
&lt;/ul&gt;<br />
*[[TextInputDialog.PHONE]]: keypad designed for entering telephone numbers
<br /></translate>
*[[TextInputDialog.EMAIL]]: keyboard optimized for specifying email addresses
<source lang="lua">
*[[TextInputDialog.URL]]: keyboard optimized for URL entry
TextInputDialog:setInputType(type)
 
</source>
=== Parameters ===
=== <translate>Parameters</translate> ===
'''type''': (string) input type associated with the text field<br/>
'''type''': (string) <translate>Tnput type associated with the text field.</translate> <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 19: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()