<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Using Adjustments the Easy Way</title> <link rel="stylesheet" href="style.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Programming with gtkmm"> <link rel="up" href="chapter-adjustment.html" title="Chapter 12. Adjustments"> <link rel="prev" href="chapter-adjustment.html" title="Chapter 12. Adjustments"> <link rel="next" href="sec-adjustment-internals.html" title="Adjustment Internals"> </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">Using Adjustments the Easy Way</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="chapter-adjustment.html"><img src="icons/prev.png" alt="Prev"></a> </td> <th width="60%" align="center">Chapter 12. Adjustments </th> <td width="20%" align="right"> <a accesskey="n" href="sec-adjustment-internals.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> </table> <hr> </div> <div class="sect1" title="Using Adjustments the Easy Way"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sec-adjustments-easy"></a>Using Adjustments the Easy Way</h2></div></div></div> <p> The adjustable widgets can be roughly divided into those which use and require specific units for these values, and those which treat them as arbitrary numbers. </p> <p> The group which treats the values as arbitrary numbers includes the <code class="classname">Range</code> widgets (<code class="classname">Scrollbars</code> and <code class="classname">Scales</code>, the <code class="classname">Progressbar</code> widget, and the <code class="classname">SpinButton</code> widget). These widgets are typically "adjusted" directly by the user with the mouse or keyboard. They will treat the <em class="parameter"><code>lower</code></em> and <em class="parameter"><code>upper</code></em> values of an adjustment as a range within which the user can manipulate the adjustment's <em class="parameter"><code>value</code></em>. By default, they will only modify the <em class="parameter"><code>value</code></em> of an adjustment. </p> <p> The other group includes the <code class="classname">Viewport</code> widget and the <code class="classname">ScrolledWindow</code> widget. All of these widgets use pixel values for their adjustments. These are also typically adjusted indirectly using scrollbars. While all widgets which use adjustments can either create their own adjustments or use ones you supply, you'll generally want to let this particular category of widgets create its own adjustments. </p> <p> TODO: Text widget is deprecated: Look at GTK+ tutorial for up-to-date example. If you share an adjustment object between a Scrollbar and a Text widget, manipulating the scrollbar will automagically adjust the Text widget. You can set it up like this: </p> <pre class="programlisting">// creates its own adjustments Gtk::Text text(0, 0); // uses the newly-created adjustment for the scrollbar as well Gtk::VScrollbar vscrollbar (*(text.get_vadjustment()));</pre> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="chapter-adjustment.html"><img src="icons/prev.png" alt="Prev"></a> </td> <td width="20%" align="center"><a accesskey="u" href="chapter-adjustment.html"><img src="icons/up.png" alt="Up"></a></td> <td width="40%" align="right"> <a accesskey="n" href="sec-adjustment-internals.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> <tr> <td width="40%" align="left" valign="top">Chapter 12. Adjustments </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"> Adjustment Internals</td> </tr> </table> </div> </body> </html>