# 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

set_text(self, input_text) | Set text for input field
get_text(self) | Return current input field text
set_max_length(self, max_length) | Set maximum length for input field.
set_allowed_characters(self, characters) | Set allowed charaters for input field.
reset_changes(self) | Reset current input selection and return previous value

## Tables

style | Component style params.

## Fields

on_input_select | On input field select callback(self, button_node)
on_input_unselect | On input field unselect callback(self, button_node)
on_input_text | On input field text change callback(self, 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_wrong | On trying user input with not allowed character callback(self, params, button_instance)
text | Text component
button | Button component
is_selected | Is current input selected now
is_empty | Is current input is empty now
max_length | Max length for input text
allowerd_characters | Pattern matching for user input

## Functions

set_text(self, input_text)
  Set text for input field

  ### Parameters:

  - self Input
  - input_text string The string to apply for input field
get_text(self)
  Return current input field text

  ### Parameters:

  - self Input

  ### Returns:

  string The current input field text
set_max_length(self, max_length)
  Set maximum length for input field. Pass nil to make input field unliminted (by default)

  ### Parameters:

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

  ### Returns:

  druid.input Current input instance
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
  - characters string Regulax exp. for validate user input

  ### Returns:

  druid.input Current input instance
reset_changes(self)
  Reset current input selection and return previous value

  ### Parameters:

  - self 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 *)
  - 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

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

generated by LDoc 1.4.6 Last updated 2020-10-12 00:44:30