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
select(self) Select input field.
unselect(self) Remove selection from input.
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
keyboard_type Gui keyboard type for input field


Functions

set_text(self, input_text)
Set text for input field

Parameters:

  • self Input
  • input_text string The string to apply for input field
select(self)
Select input field. It will show the keyboard and trigger on_select events

Parameters:

  • self Input
unselect(self)
Remove selection from input. It will hide the keyboard and trigger on_unselect events

Parameters:

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

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)
keyboard_type
Gui keyboard type for input field
  • keyboard_type number
generated by LDoc 1.4.6 Last updated 2021-10-23 17:45:31