Quick Ref - UI TextField

A quick reference to the TextField Widget & Style.

Widget

Constructor

dUI = require 'dmc_ui'

widget = dUI.newTextField()

widget = dUI.newTextField{
  text = "Hello",
  style = {
    -- style properties here
  }
}

Properties & Methods

widget.hintText = "Email:"
widget.text = "bob@yahoo.com"
widget.style
widget.backgroundStyle
widget.hintStyle
widget.displayStyle

widget.delgate
widget.isEditing (r/o)

widget:setEditActive()
widget:setKeyboardFocus()
widget:unsetKeyboardFocus()
widget:setReturnKey()

Style Properties & Methods

widget.debugOn
widget.width
widget.height

widget.align
widget.anchorX
widget.anchorY
widget.backgroundType
widget.isHitActive
widget.isSecure
widget.inputType
widget.marginX
widget.marginY

widget.hintFont
widget.hintFontSize
widget:setHintTextColor()
widget.displayFont
widget.displayFontSize
widget:setDisplayTextColor()

Style

Constructor

dUI = require 'dmc_ui'

style = dUI.newTextFieldStyle{
  debugOn = false,
  width = 100,
  height = 50,

  align = 'left',
  anchorX = 0.5,
  anchorY = 1.0,
  backgroundStyle = 'none',
  isHitActive = true,
  isSecure = false,
  inputType = 'default',
  marginX = 10,
  marginY = 5,
  returnKey = 'done',

  background = {
    -- Style.Background (9-slice, rounded, etc)
  }

  hint = {
    -- Style.Text

    fillColor={0,0,0,0},
    font=native.systemFont,
    fontSize=18,
    marginX=15,
    textColor={0.3,0.3,0.3,1},
  },

  display = {
    -- Style.Text

    fillColor={0,0,0,0},
    font=native.systemFont,
    fontSize=18,
    marginX=15,
    textColor={0.3,0.3,0.3,1},
  }

}

Properties

All properties listed above can also be accessed from the Style object:

style.anchorX = 0.5