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

Name Type Optional Default Descripton
sText String checked "" The text to show in the text field

Properties

Name Type get set Descripton
align String checked checked The text alignment. Valid values are:

left
right
center
allowTab Boolean checked checked Whether pressing the tab key should insert a tab character or move the focus from the text field
font BiFont checked checked This is used to describe how to paint the text in the text field.
invalidMessage String checked checked This property can be used to give information about why the value might be invalid.
isValid Boolean checked Uses the validator to determine whether the text inside the component is valid.
maxLength Number checked checked The maximum number of characters that the user can enter into the text field
paddingBottom Number checked checked The bottom padding (in pixels)
paddingLeft Number checked checked The left padding (in pixels)
paddingRight Number checked checked The right padding (in pixels)
paddingTop Number checked checked The top padding (in pixels)
readOnly Boolean checked checked Whether the user can enter text in the text field
selectionLength Number checked checked The length (number of chracters) of the currently selected text in the text field
selectionStart Number checked checked The starting point of the selection in the text field. If not selected this returns -1.
selectionText String checked checked The currently selected text in the text field
text String checked checked The text on the text field
validator Function checked checked This 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

Name Description
selectAll Selects all text in the text field
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.

Events

Name Type Bubbles Descripton
action BiEvent This event is fired when the enter key is pressed
change BiEvent This event is fired when the text field is blurred and the text has changed since the text field got focus.
textchanged BiEvent This 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

Name Description
createRegExpValidator This 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

Name Type Optional Default Descripton
nLeft Number Left padding
nRight Number checked Right padding
nTop Number checked Top padding
nBottom Number checked Bottom 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

Name Type Optional Default Descripton
oRegExp RegExp The regular expression that will be tested against the text of the text field.

Return Type

Function