[Control] numField

Part of: mobl::ui::generic

Arguments:

  • n : Num variable/property to bind the control to.
  • label : String = null label text (optional)
  • validator : Function1<Num,String> = alwaysOkValidator validator function, takes n as argument and returns error message or empty string if OK (optional)
  • style : Style = textFieldStyle the style to use for the field
  • invalidStyle : Style = textFieldInvalidStyle the style to use for the field on invalid input
  • autofocus : Bool = false whether the control should get immediately get focus when loaded.
  • step : Num step size
  • max : Num maximum value
  • min : Num minimum value
  • onchange : Callback = null event triggered when the text field changed and loses focus (optional).
  • onkeyup : Callback = null event triggered on every keypress (optional).

A numeric input field control.

Example:

var age = 27
group {
  item { numField(age, label="Age") }
}

Example 2:

function validateAge(n : String) : String {
  return n >= 18 ? "" : "You have to be at least 18";
}
...
group {
  item { numField(age, validator=validateAge) }
}
mobl/ui/generic/numfield.txt · Last modified: 2013/10/01 02:29 (external edit)