BiTextField

This class is used to display a single line plain text input

This class extends BiComponent and therefore all methods and fields available for BiComponent are also available for BiTextField .

Constructor

new BiTextField ( [ sText ] )

Parameters

NameTypeOptionalDefaultDescripton
sTextStringchecked"" The text to show in the text field

Properties

NameTypegetsetDescripton
alignStringcheckedcheckedThe text alignment. Valid values are:

left
right
center
allowTabBooleancheckedcheckedWhether pressing the tab key should insert a tab character or move the focus from the text field
fontBiFontcheckedcheckedThis is used to describe how to paint the text in the text field.
invalidMessageStringcheckedcheckedThis property can be used to give information about why the value might be invalid.
isValidBooleancheckedUses the validator to determine whether the text inside the component is valid.
maxLengthNumbercheckedcheckedThe maximum number of characters that the user can enter into the text field
paddingBottomNumbercheckedcheckedThe bottom padding (in pixels)
paddingLeftNumbercheckedcheckedThe left padding (in pixels)
paddingRightNumbercheckedcheckedThe right padding (in pixels)
paddingTopNumbercheckedcheckedThe top padding (in pixels)
readOnlyBooleancheckedcheckedWhether the user can enter text in the text field
selectionLengthNumbercheckedcheckedThe length (number of chracters) of the currently selected text in the text field
selectionStartNumbercheckedcheckedThe starting point of the selection in the text field. If not selected this returns -1.
selectionTextStringcheckedcheckedThe currently selected text in the text field
textStringcheckedcheckedThe text on the text field
validatorFunctioncheckedcheckedThis property is a function that is used to validate the text of the text field. The function should take a string and return true if the text is valid.

Methods

NameDescription
selectAllSelects all text in the text field
setPaddingSets the padding on more than one side. This method can ba called with 1, 2 or 4 arguments. In case of 1 argument it sets the padding on all sides. If 2 arguments are used then the padding on the left/right and top/bottom are set to the same. And if called with 4 all 4 sides can have different padding,

setPadding(nPadding) - Sets the padding on all sides to nPadding
setPadding(nLeftRight, nTopBottom) - Sets the padding on the left and right to nLeftRight and the padding on the top and bottom to nTopBottom
setPadding(nLeft, nRight, nTop, nBottom) - Sets the padding on all sides to nLeft, nRight, nTop and nBottom respectively.

Events

NameTypeBubblesDescripton
actionBiEventThis event is fired when the enter key is pressed
changeBiEventThis event is fired when the text field is blurred and the text has changed since the text field got focus.
textchangedBiEventThis event is fired when the text has changed. This happens when the user in some way changes the text inside the text field. This event is fired continiously as the user types.

Static Methods

NameDescription
createRegExpValidatorThis method takes a regular expression object and returns a function that can then be used for the validator property.

Static Fields

None.

Remarks

To change the font of the component you have to use setFont(). Changing the font object without calling setFont() will not update the component. If the text field has a command the command will be executed when the user presses the enter key.

Method Details

selectAll

Selects all text in the text field

Syntax

object.selectAll ( )

Parameters

No arguments.

Return Type

void

setPadding

Sets the padding on more than one side. This method can ba called with 1, 2 or 4 arguments. In case of 1 argument it sets the padding on all sides. If 2 arguments are used then the padding on the left/right and top/bottom are set to the same. And if called with 4 all 4 sides can have different padding,

setPadding(nPadding) - Sets the padding on all sides to nPadding
setPadding(nLeftRight, nTopBottom) - Sets the padding on the left and right to nLeftRight and the padding on the top and bottom to nTopBottom
setPadding(nLeft, nRight, nTop, nBottom) - Sets the padding on all sides to nLeft, nRight, nTop and nBottom respectively.

Syntax

object.setPadding ( nLeft [ ,nRight [ ,nTop [ ,nBottom ] ] ] )

Parameters

NameTypeOptionalDefaultDescripton
nLeftNumberLeft padding
nRightNumbercheckedRight padding
nTopNumbercheckedTop padding
nBottomNumbercheckedBottom padding

Return Type

void

Static Method Details

createRegExpValidator

This method takes a regular expression object and returns a function that can then be used for the validator property.

Syntax

BiTextField . createRegExpValidator ( oRegExp )

Parameters

NameTypeOptionalDefaultDescripton
oRegExpRegExpThe regular expression that will be tested against the text of the text field.

Return Type

Function