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 | ![]() | "" | The text to show in the text field |
Properties
| Name | Type | get | set | Descripton |
align | String | ![]() | ![]() | The text alignment. Valid values are:left right center |
allowTab | Boolean | ![]() | ![]() | Whether pressing the tab key should insert a tab character or move the focus from the text field |
font | | ![]() | ![]() | This is used to describe how to paint the text in the text field. |
invalidMessage | String | ![]() | ![]() | This property can be used to give information about why the value might be invalid. |
isValid | Boolean | ![]() | Uses the validator to determine whether the text inside the component is valid. | |
maxLength | Number | ![]() | ![]() | The maximum number of characters that the user can enter into the text field |
paddingBottom | Number | ![]() | ![]() | The bottom padding (in pixels) |
paddingLeft | Number | ![]() | ![]() | The left padding (in pixels) |
paddingRight | Number | ![]() | ![]() | The right padding (in pixels) |
paddingTop | Number | ![]() | ![]() | The top padding (in pixels) |
readOnly | Boolean | ![]() | ![]() | Whether the user can enter text in the text field |
selectionLength | Number | ![]() | ![]() | The length (number of chracters) of the currently selected text in the text field |
selectionStart | Number | ![]() | ![]() | The starting point of the selection in the text field. If not selected this returns -1. |
selectionText | String | ![]() | ![]() | The currently selected text in the text field |
text | String | ![]() | ![]() | The text on the text field |
validator | Function | ![]() | ![]() | 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 | | This event is fired when the enter key is pressed | |
change | | This event is fired when the text field is blurred and the text has changed since the text field got focus. | |
textchanged | | 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 | ![]() | Right padding | |
nTop | Number | ![]() | Top padding | |
nBottom | Number | ![]() | 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
