# Defold Druid UI Library

# Module `Input`

Druid input text component.

Carry on user text input

### Info:

- Author: Part of code from Britzl gooey input component

## Functions

get_text(self) | Return current input field text
init(self, click_node, text_node[, keyboard_type]) | Component init function
reset_changes(self) | Reset current input selection and return previous value
select(self) | Select input field.
set_allowed_characters(self, characters) | Set allowed charaters for input field.
set_max_length(self, max_length) | Set maximum length for input field.
set_text(self, input_text) | Set text for input field
unselect(self) | Remove selection from input.

## Tables

style | Component style params.

## Fields

allowerd_characters | Pattern matching for user input
button | Button component
is_empty | Is current input is empty now
is_selected | Is current input selected now
keyboard_type | Gui keyboard type for input field
max_length | Max length for input text
on_input_empty | On input field text change to empty string callback(self, input_text)
on_input_full | On input field text change to max length string callback(self, input_text)
on_input_select | On input field select callback(self, button_node)
on_input_text | On input field text change callback(self, input_text)
on_input_unselect | On input field unselect callback(self, input_text)
on_input_wrong | On trying user input with not allowed character callback(self, params, button_instance)
text | Text component

## Functions

get_text(self)
  Return current input field text

  ### Parameters:

  - self Input Input

  ### Returns:

  string The current input field text
init(self, click_node, text_node[, keyboard_type])
  Component init function

  ### Parameters:

  - self Input Input
  - click_node node Button node to enabled input component
  - text_node node or Text Text node what will be changed on user input. You can pass text component instead of text node name Text
  - keyboard_type number Gui keyboard type for input field (optional)
reset_changes(self)
  Reset current input selection and return previous value

  ### Parameters:

  - self Input Input
select(self)
  Select input field. It will show the keyboard and trigger on_select events

  ### Parameters:

  - self Input Input
set_allowed_characters(self, characters)
  Set allowed charaters for input field. See: https://defold.com/ref/stable/string/ ex: [%a%d] for alpha and numeric

  ### Parameters:

  - self Input Input
  - characters string Regulax exp. for validate user input

  ### Returns:

  druid.input Current input instance
set_max_length(self, max_length)
  Set maximum length for input field. Pass nil to make input field unliminted (by default)

  ### Parameters:

  - self Input Input
  - max_length number Maximum length for input text field

  ### Returns:

  druid.input Current input instance
set_text(self, input_text)
  Set text for input field

  ### Parameters:

  - self Input Input
  - input_text string The string to apply for input field
unselect(self)
  Remove selection from input. It will hide the keyboard and trigger on_unselect events

  ### Parameters:

  - self Input Input

## Tables

style
  Component style params. You can override this component styles params in druid styles table or create your own style

  ### Fields:

  - IS_LONGTAP_ERASE bool Is long tap will erase current input data (default false)
  - MASK_DEFAULT_CHAR string Default character mask for password input (default *)
  - IS_UNSELECT_ON_RESELECT bool If true, call unselect on select selected input (default false)
  - on_select function (self, button_node) Callback on input field selecting
  - on_unselect function (self, button_node) Callback on input field unselecting
  - on_input_wrong function (self, button_node) Callback on wrong user input
  - button_style table Custom button style for input node

## Fields

allowerd_characters
  Pattern matching for user input
  - allowerd_characters string (optional)
button
  Button component
  - button Button Button
is_empty
  Is current input is empty now
  - is_empty bool
is_selected
  Is current input selected now
  - is_selected bool
keyboard_type
  Gui keyboard type for input field
  - keyboard_type number
max_length
  Max length for input text
  - max_length number (optional)
on_input_empty
  On input field text change to empty string callback(self, input_text)
  - on_input_empty DruidEvent DruidEvent
on_input_full
  On input field text change to max length string callback(self, input_text)
  - on_input_full DruidEvent DruidEvent
on_input_select
  On input field select callback(self, button_node)
  - on_input_select DruidEvent DruidEvent
on_input_text
  On input field text change callback(self, input_text)
  - on_input_text DruidEvent DruidEvent
on_input_unselect
  On input field unselect callback(self, input_text)
  - on_input_unselect DruidEvent DruidEvent
on_input_wrong
  On trying user input with not allowed character callback(self, params, button_instance)
  - on_input_wrong DruidEvent DruidEvent
text
  Text component
  - text Text Text

generated by LDoc TESTING Last updated 2015-01-01 12:00:00