class SINTextInput
package com.feathersui.controls
extends FeathersControl
implements IStageFocusDelegate, ITextControl, IStateContext<TextInputState>
A text input component for Social Insurance Numbers (SIN) in Canada. A
social insurance number consists of nine digits, divided into three parts of
three digits each. An example social insurance number is 123 456 789
.
Events:
openfl.events.Event.CHANGE | Dispatched when |
---|
feathersui-text-inputs-pack 1.0.0
.See also:
Static variables
staticfinalread onlyCHILD_VARIANT_ERROR_CALLOUT:String = "sinTextInput_errorCallout"
The variant used to style the error string TextCallout
child component
in a theme.
To override this default variant, set the
SINTextInput.customErrorCalloutVariant
property.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.style.IVariantStyleObject.variant
Constructor
new(text:String = "", ?changeListener:Event ‑> Void)
Creates a new SINTextInput
object.
feathersui-text-inputs-pack 1.0.0
.Variables
backgroundSkin:DisplayObject
The default background skin for the text input, which is used when no
other skin is defined for the current state with setSkinForState()
.
The following example passes a bitmap for the text input to use as a background skin:
input.backgroundSkin = new Bitmap(bitmapData);
feathersui-text-inputs-pack 1.0.0
.See also:
read onlybaseline:Float
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.ITextControl.baseline
read onlycurrentState:TextInputState
The current state of the text input.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextInputState
FeathersEvent.STATE_CHANGE
customErrorCalloutVariant:String
A custom variant to set on the error callout, instead of
SINTextInput.CHILD_VARIANT_ERROR_CALLOUT
.
The customErrorCalloutVariant
will be not be used if the TextCallout
already has a variant set.
feathersui-text-inputs-pack 1.0.0s
.See also:
feathers.style.IVariantStyleObject.variant
disabledTextFormat:AbstractTextFormat
The font styles used to render the text input's text when the text input is disabled.
In the following example, the text input's disabled text formatting is customized:
input.enabled = false;
input.disabledTextFormat = new TextFormat("Helvetica", 20, 0xee0000);
feathersui-text-inputs-pack 1.0.0
.See also:
editable:Bool
Indicates if the text input is editable.
The following example disables editing:
textInput.editable = false;
feathersui-text-inputs-pack 1.0.0
.embedFonts:Bool
Determines if an embedded font is used or not.
In the following example, the text input uses embedded fonts:
input.embedFonts = true;
feathersui-text-inputs-pack 1.0.0
.See also:
errorCalloutFactory:AbstractDisplayObjectFactory<Dynamic, TextCallout>
Creates the error callout, which must be of type
feathers.controls.TextCallout
.
In the following example, a custom error callout factory is provided:
textInput.errorCalloutFactory = () ->
{
return new TextCallout();
};
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextCallout
errorString:String
Error text to display in a TextCallout
when the text input has focus.
When this value is not null
the text input's currentState
is
changed to TextInputState.ERROR
.
An empty string will change the background, but no TextCallout
will
appear on focus.
To clear an error, the errorString
property must be set to null
.
The following example displays an error string:
input.errorString = "Something is wrong";
feathersui-text-inputs-pack 1.0.0
.See also:
read onlyerrorStringCalloutOpen:Bool
Indicates if the callout for the errorString
is currently open or
closed.
feathersui-text-inputs-pack 1.0.0
.See also:
leftView:DisplayObject
An optional view displayed inside the text input, to the left of its text.
The following example passes a bitmap for the text input to use as a left view:
input.leftView = new Bitmap(bitmapData);
feathersui-text-inputs-pack 1.0.0
.See also:
leftViewGap:Float
The gap between the left view and the text.
The following example sets the left view's gap to 20 pixels:
input.leftViewGap = 20.0;
feathersui-text-inputs-pack 1.0.0
.See also:
paddingBottom:Float
The minimum space, in pixels, between the text input's bottom edge and the text input's content.
In the following example, the text input's bottom padding is set to 20 pixels:
input.paddingBottom = 20.0;
feathersui-text-inputs-pack 1.0.0
.paddingLeft:Float
The minimum space, in pixels, between the text input's left edge and the text input's content.
In the following example, the text input's left padding is set to 20 pixels:
input.paddingLeft = 20.0;
feathersui-text-inputs-pack 1.0.0
.paddingRight:Float
The minimum space, in pixels, between the text input's right edge and the text input's content.
In the following example, the text input's right padding is set to 20 pixels:
input.paddingRight = 20.0;
feathersui-text-inputs-pack 1.0.0
.paddingTop:Float
The minimum space, in pixels, between the text input's top edge and the text input's content.
In the following example, the text input's top padding is set to 20 pixels:
input.paddingTop = 20.0;
feathersui-text-inputs-pack 1.0.0
.rightView:DisplayObject
An optional view displayed inside the text input, to the right of its text.
The following example passes a bitmap for the text input to use as a right view:
input.rightView = new Bitmap(bitmapData);
feathersui-text-inputs-pack 1.0.0
.See also:
rightViewGap:Float
The gap between the right view and the text.
The following example sets the right view's gap to 20 pixels:
input.rightViewGap = 20.0;
feathersui-text-inputs-pack 1.0.0
.See also:
text:String
The SIN string displayed by the text input. Always returns a formatted
SIN with a space between each group of three digits. May be set with a
string that has the same formatting. However, the setter also accepts a
string of numeric digits only with no spaces, or it will allow a -
character as the delimiter between each group of three digits instead of
a space. Partial SIN values are allowed as well.
When the value of the text
property changes, the text input will
dispatch an event of type Event.CHANGE
.
The following example sets the text input's text to a valid SIN:
input.text = "123 456 789";
The following example sets the text input's text to a valid SIN without delimiters between each groups of three digits:
input.text = "123456789";
The following example sets the text input's text to a valid partial SIN:
input.text = "123 4";
feathersui-text-inputs-pack 1.0.0
.See also:
textFormat:AbstractTextFormat
The font styles used to render the text input's text.
In the following example, the text input's formatting is customized:
input.textFormat = new TextFormat("Helvetica", 20, 0xcc0000);
feathersui-text-inputs-pack 1.0.0
.See also:
verticalAlign:VerticalAlign
How the content is positioned vertically (along the y-axis) within the text input.
The following example aligns the text input's content to the top:
input.verticalAlign = TOP;
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.layout.VerticalAlign.TOP
feathers.layout.VerticalAlign.MIDDLE
feathers.layout.VerticalAlign.BOTTOM
feathers.layout.VerticalAlign.JUSTIFY
Methods
getSkinForState(state:TextInputState):DisplayObject
Gets the skin to be used by the text input when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, returns null
.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextInputState
getTextFormatForState(state:TextInputState):AbstractTextFormat
Gets the text format to be used by the text input when its currentState
property matches the specified state value.
If a text format is not defined for a specific state, returns null
.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextInputState
setPadding(value:Float):Void
Sets all four padding properties to the same value.
feathersui-text-inputs-pack 1.0.0
.See also:
setSkinForState(state:TextInputState, skin:DisplayObject):Void
Set the skin to be used by the text input when its currentState
property matches the specified state value.
If a skin is not defined for a specific state, the value of the
backgroundSkin
property will be used instead.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextInputState
setTextFormatForState(state:TextInputState, textFormat:AbstractTextFormat):Void
Set the text format to be used by the text input when its currentState
property matches the specified state value.
If a text format is not defined for a specific state, the value of the
textFormat
property will be used instead.
feathersui-text-inputs-pack 1.0.0
.See also:
feathers.controls.TextInputState