TextInputDialog

From GiderosMobile
Revision as of 14:33, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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