60 lines
7.8 KiB
HTML
60 lines
7.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - System Overview - The Interface Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInterfaceKit_Overview.html" title="The Interface Kit" /><link rel="prev" href="BTabView_Overview.html" title="BTabView" /><link rel="next" href="BTextView_Overview.html" title="BTextView" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BTabView_Overview.html" title="BTabView"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit_Overview.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BTextView_Overview.html" title="BTextView"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - System Overview - The Interface Kit</div></div><div id="headerB">Prev: <a href="BTabView_Overview.html">BTabView</a> Up: <a href="TheInterfaceKit_Overview.html">The Interface Kit</a> Next: <a href="BTextView_Overview.html">BTextView</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BTextControl_Overview"></a>BTextControl</h2></div></div></div><a id="id559539" class="indexterm"></a><p>
|
||
A <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
object displays a labeled text field that behaves like
|
||
other control devices. When the user presses certain keys after modifying
|
||
the text in the field, it delivers a message to a designated target.
|
||
</p><p>
|
||
There are two parts to the view: A static label on the left, which the
|
||
user cannot modify, and an editable field on the right, which behaves
|
||
just like a one-line <a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>.
|
||
In fact, the <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a> installs a
|
||
<a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>
|
||
object as its child to handle editing chores within this part
|
||
of the view. It's this child view that responds to keyboard events for
|
||
the <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
rather than the control object itself.
|
||
</p><p>
|
||
The child <a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>
|
||
must become the focus view for the window before the
|
||
user can enter or edit text in the field. If the user modifies the
|
||
contents of the field and then causes the child to cease being the focus
|
||
view, the <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
delivers a message to its target, just like any
|
||
other <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a>
|
||
object when it's invoked. The message notifies the target
|
||
that the user has finished making changes to the text. (It doesn't matter
|
||
what causes the change in focus—a click in another text field, for
|
||
example, or a <code class="constant">B_TAB</code> character that navigates to another view.)
|
||
</p><p>
|
||
The <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
is also invoked when the user types a <code class="constant">B_ENTER</code> character,
|
||
though this doesn't change the focus view. It selects all the text in the
|
||
field.
|
||
</p><p>
|
||
You can arrange for another message—a "modification
|
||
message"—to be sent when the user makes the first change to the
|
||
text after the child <a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a> has become the focus view (or after
|
||
<code class="constant">B_ENTER</code> caused all the text to be selected). This message notifies the
|
||
target that editing has begun.
|
||
</p><p>
|
||
Note that <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>s
|
||
only allow the user to edit a single line of text; newline characters are
|
||
automatically stripped from the text, if they're inserted.
|
||
</p><p>
|
||
Because the label is drawn by the
|
||
<a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
itself and the editable text is drawn by its child
|
||
<a class="link" href="BTextView.html" title="BTextView"><code class="classname">BTextView</code></a>,
|
||
you can assign different properties (color or font, for example) to each string.
|
||
The <a class="link" href="BTextControl.html" title="BTextControl"><code class="classname">BTextControl</code></a>
|
||
has only one child;
|
||
<a class="link" href="BView.html#BView_ChildAt"><code class="methodname">ChildAt()</code></a>
|
||
returns it when passed an index of 0.
|
||
</p></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BTabView_Overview.html">BTabView</a> Up: <a href="TheInterfaceKit_Overview.html">The Interface Kit</a> Next: <a href="BTextView_Overview.html">BTextView</a> </div><div id="footerB"><div id="footerBL"><a href="BTabView_Overview.html" title="BTabView"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit_Overview.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BTextView_Overview.html" title="BTextView"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|