behavior: decimal

Decimal number input behavior.

Elements

that have this behavior applied by default (see master style sheet):

  • <input type=“decimal” /> - inline single line
  • <widget type=“decimal”></widget>

Attributes

that this behavior knows about:

  • value=float - initial value of the input element
  • size=integer - determines value of (intrinsic and default) width of the element.
  • format - format of number representation, string that accepts following ';'-separated fields:
    • grouping - number, number of digits in “thousand” groups.
    • fdigits - number, fractional digits to show.
    • leading-zero - true/false, show leading zero.
    • decimal-sep - string, separator between integer and fractional parts.
    • grouping-sep - string, separator between groups.
    • negative-sign - true/false, true - show '-', false - wrap digits by '(' ')' characters.

example:

format="grouping:3; 
   fdigits:4; 
   leading-zero:false; 
   decimal-sep:','; 
   thousand-sep:'_'; 
   negative-sign:false"

format attribute can also be defined in CSS as a custom attribute -format. Thus you may define it for group of input elements as:

input.decimal 
{
  behavior:decimal;
  -format="fdigits:2; leading-zero:true;"
}

Methods

The behavior supports following xcall() methods (see dom::element::xcall() function):

  • xcall(“min”): int - returns min limit;
  • xcall(“min”, v:int) - sets min limit;
  • xcall(“max”): int - returns max limit;
  • xcall(“max”, v:int) - sets max limit;
  • xcall(“step”): int - returns step value;
  • xcall(“step”, v:int|undefined) - sets/clears step;

Events

Together with the standard set of events (mouse, keyboard, focus) behavior: button generates:

  • EDIT_VALUE_CHANGED event - value of the element was changed due to user actions. Posted (asynchronous) event.
  • EDIT_VALUE_CHANGING event - sent when value of the element is about to change. Synchronous event.

Value

type json::value::V_FLOAT, reflects current status of internal editing buffer.

Special key combinations

See edit

h-smile/built-in-behaviors/decimal.txt · Last modified: 2009/12/15 12:42 by andrew
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0