<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Entry</title> <link rel="stylesheet" href="style.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2"> <link rel="start" href="index.html" title="Programming with gtkmm"> <link rel="up" href="ch06.html" title="Chapter 6. Miscellaneous Widgets"> <link rel="prev" href="ch06.html" title="Chapter 6. Miscellaneous Widgets"> <link rel="next" href="ch06s03.html" title="SpinButton"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">Entry</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch06.html"><img src="../icons/prev.png" alt="Prev"></a> </td> <th width="60%" align="center">Chapter 6. Miscellaneous Widgets</th> <td width="20%" align="right"> <a accesskey="n" href="ch06s03.html"><img src="../icons/next.png" alt="Next"></a> </td> </tr> </table> <hr> </div> <div class="sect1" lang="en"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sec-TextEntries"></a>Entry</h2></div></div></div> <p> Entry widgets allow the user to enter text (surprisingly enough). </p> <p> You can change the contents with the <code class="function">set_text()</code> method, and read the current contents with the <code class="function">get_text()</code> method. </p> <p> Occasionally you might want to make an <code class="classname">Entry</code> widget read-only. This can be done by passing <code class="literal">false</code> to the <code class="function">set_editable()</code> method. </p> <p> For the input of passwords, passphrases and other information you don't want echoed on the screen, calling <code class="function">set_visibility()</code> with <code class="literal">false</code> will cause the text to be hidden. </p> <p> You might want to be notified whenever the user types in a text entry widget. <code class="classname">Gtk::Entry</code> provides two signals, <code class="literal">activate</code> and <code class="literal">changed</code>, for just this purpose. <code class="literal">activate</code> is emitted when the user presses the enter key in a text-entry widget; <code class="literal">changed</code> is emitted when the text in the widget changes. You can use these, for instance, to validate or filter the text the user types. </p> <p><a class="ulink" href="../../reference/html/classGtk_1_1Entry.html" target="_top">Reference</a></p> <div class="sect2" lang="en"> <div class="titlepage"><div><div><h3 class="title"> <a name="id2573024"></a>Example</h3></div></div></div> <p> Here is an example using <code class="classname">Gtk::Entry</code>. As well as a <code class="classname">Gtk::Entry</code> widget, it has two <code class="classname">CheckButton</code>s, with which you can toggle the editable and visible flags. </p> <div class="figure"> <a name="figure-entry"></a><p class="title"><b>Figure 6.2. Entry</b></p> <div class="figure-contents"><div class="screenshot"><div><img src="../figures/entry.png" alt="Entry"></div></div></div> </div> <br class="figure-break"><p><a class="ulink" href="../../../examples/book/entry" target="_top">Source Code</a></p> </div> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch06.html"><img src="../icons/prev.png" alt="Prev"></a> </td> <td width="20%" align="center"><a accesskey="u" href="ch06.html"><img src="../icons/up.png" alt="Up"></a></td> <td width="40%" align="right"> <a accesskey="n" href="ch06s03.html"><img src="../icons/next.png" alt="Next"></a> </td> </tr> <tr> <td width="40%" align="left" valign="top">Chapter 6. Miscellaneous Widgets </td> <td width="20%" align="center"><a accesskey="h" href="index.html"><img src="../icons/home.png" alt="Home"></a></td> <td width="40%" align="right" valign="top"> SpinButton</td> </tr> </table> </div> </body> </html>