📄 bitextfield.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--
Generated using api.website.xsl version 2003-07-17
-->
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BiTextField</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript">
function showDerivedClasses() {
var ul = document.getElementById("api-derived-classes");
var lis = ul.childNodes;
var l = lis.length;
for (var i = 1; i < l; i++)
lis[i].style.display = "";
lis[0].style.display = "none";
}
</script></head>
<body>
<h1 id="BiTextField">BiTextField</h1>
<p>
This class is used for display a single line plain text input
</p>
<p>This class extends
<code><a href="BiComponent.html">BiComponent</a></code>
and therefore all methods and fields available for
<code><a href="BiComponent.html">BiComponent</a></code>
are also available for <code>BiTextField</code>.</p>
<ul class="partial-class-tree">
<li><code><a href="BiObject.html">BiObject</a></code><ul>
<li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code><a href="BiComponent.html">BiComponent</a></code><ul><li><code>BiTextField</code><ul id="api-derived-classes"><li><code><a href="BiPasswordField.html">BiPasswordField</a></code></li><li><code><a href="BiTextArea.html">BiTextArea</a></code></li></ul></li></ul></li></ul></li></ul>
</li>
</ul>
<h2>Constructor</h2>
<p><code>
new BiTextField([<span class="methodArgument">sText</span>])</code></p>
<h3>Parameters</h3>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>sText</code></td>
<td><code class="type">String</code></td>
<td class="optional-column"><img src="check.png" alt="checked"></td>
<td></td>
<td>The text to show in the text field</td>
</tr>
</tbody>
</table>
<h2>Properties</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="get-header">get</td>
<td class="set-header">set</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><a name="align"></a><code>align</code></td>
<td><code class="type">String</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>
The text alignment. Valid values are:<br>
<br>
<code>left</code><br>
<code>right</code><br>
<code>center</code>
</td>
</tr>
<tr>
<td><a name="font"></a><code>font</code></td>
<td><code class="type"><code><a href="BiFont.html">BiFont</a></code></code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>This is used to describe how to paint the text in the text field.</td>
</tr>
<tr>
<td><a name="invalidMessage"></a><code>invalidMessage</code></td>
<td><code class="type">String</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>
This property can be used to give information about why the value
might be invalid.
</td>
</tr>
<tr>
<td><a name="isValid"></a><code>isValid</code></td>
<td><code class="type">Boolean</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"></td>
<td>
Uses the validator to determine whether the text inside
the component is valid.
</td>
</tr>
<tr>
<td><a name="maxLength"></a><code>maxLength</code></td>
<td><code class="type">Number</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>The maximum number of characters that the user can enter into the text field</td>
</tr>
<tr>
<td><a name="readOnly"></a><code>readOnly</code></td>
<td><code class="type">Boolean</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>Whether teh user can enter text in the text field</td>
</tr>
<tr>
<td><a name="selectionLength"></a><code>selectionLength</code></td>
<td><code class="type">Number</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>The length (number of chracters) of the currently selected text in the text field</td>
</tr>
<tr>
<td><a name="selectionStart"></a><code>selectionStart</code></td>
<td><code class="type">Number</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>The starting point of the selection in the text field. If not selected this returns -1.</td>
</tr>
<tr>
<td><a name="selectionText"></a><code>selectionText</code></td>
<td><code class="type">String</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>The currently selected text in the text field</td>
</tr>
<tr>
<td><a name="text"></a><code>text</code></td>
<td><code class="type">String</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>The text on the text field</td>
</tr>
<tr>
<td><a name="validator"></a><code>validator</code></td>
<td><code class="type">Function</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>
This property is a function that is used to validate the text of
the text field. The function should take a string and return
<code>true</code> if the text is valid.
</td>
</tr>
</tbody>
</table>
<h2>Methods</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="#selectAll">selectAll</a></code></td>
<td>Selects all text in the text field</td>
</tr>
</tbody>
</table>
<h2>Events</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="bubbles-header">Bubbles</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><a name="action"></a><code>action</code></td>
<td><code class="type"><code><a href="BiEvent.html">BiEvent</a></code></code></td>
<td class="bubbles-column"></td>
<td>This event is fired when the enter key is pressed</td>
</tr>
<tr>
<td><a name="change"></a><code>change</code></td>
<td><code class="type"><code><a href="BiEvent.html">BiEvent</a></code></code></td>
<td class="bubbles-column"></td>
<td>This event is fired when the text field is blurred and
the text has changed since the text field got focus.</td>
</tr>
<tr>
<td><a name="textchanged"></a><code>textchanged</code></td>
<td><code class="type"><code><a href="BiEvent.html">BiEvent</a></code></code></td>
<td class="bubbles-column"></td>
<td>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.</td>
</tr>
</tbody>
</table>
<h2>Static Methods</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="#createRegExpValidator">createRegExpValidator</a></code></td>
<td>
This method takes a regular expression object and returns
a function that can then be used for the <code><a href="#validator">validator</a></code>
property.
</td>
</tr>
</tbody>
</table>
<h2>Static Fields</h2>
<p>None.</p>
<h2>Remarks</h2>
<p>
To change the font of the component you have to use
<code><a href="#font">setFont()</a></code>. Changing the
font object without calling <code><a href="#font">setFont()</a></code>
will not update the component.<br>
<br>
If the text field has a <code><a href="BiComponent.html#command">command</a></code>
the command will be <code><a href="BiCommand.html#execute">executed</a></code>
when the user presses the enter key.
</p>
<h2>Method Details</h2>
<h3><a name="selectAll"></a>selectAll</h3>
<p>Selects all text in the text field</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.selectAll()</pre>
<h4>Parameters</h4>
<p>No arguments.</p>
<h4>Return Type</h4>
<p><code class="type">void</code></p>
<h2>Static Method Details</h2>
<h3><a name="createRegExpValidator"></a>createRegExpValidator</h3>
<p>
This method takes a regular expression object and returns
a function that can then be used for the <code><a href="#validator">validator</a></code>
property.
</p>
<h4>Syntax</h4>
<pre class="method-syntax">BiTextField.createRegExpValidator(<span class="methodArgument">oRegExp</span>)</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>oRegExp</code></td>
<td><code class="type">RegExp</code></td>
<td class="optional-column"></td>
<td></td>
<td>
The regular expression that will be tested against the
text of the text field.
</td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type">Function</code></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -