Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams

Check Buttons

We will now add a label and 3 check buttons to the next row of our canvas. This will be used to indicate what we want counted: words, lines, and bytes. So we need space for 4 widgets which we achieve with the Horizontal Box widget of the GTK+ Basic palette. When prompted change the default 3 columns to 4 columns.

Add a Label to the first cell of this row and change the text of the label to `What to count:.' This label is called label2 in our collection of widgets. You may like to set the X Pad field to 10.

Now add a check button for `Words' in the next cell of this row. The check button widget is the third widget of the third row of the GTK+ Basic palette--the third row contains 4 different types of buttons. Select the Check Button from the palette with the left mouse button then click the left mouse button in the second cell of the second row of your canvas. This creates a new widget called checkbutton1. Change the Label: text field in the Properties window for this new checkbutton to read `Words.' Similarly add check buttons for `Lines' and `Bytes.' That is, select the Check Button on the palette again then click in the next cell of your canvas. Note that after you place a widget on your canvas the selected widget button on the palette becomes in-active and the left mouse button reverts to being used for selection.

Image glade-gword-almost
By default we will only count words so the Words button should be on by default. This is easily achieved by editing the widget properties. Select the Words button on your canvas. Then in the Properties window under the Widget tab click on the button that says No alongside the Initially On label. This will change this property's button to be indented and to read Yes and the corresponding check button on your canvas is now also turned on.

Also add tooltips for each check button, selecting each of the check buttons, in turn, and adding text to the Tooltips field of the Basic tab of the Properties window.

Copyright © 1995-2006 [email protected]
Contribue and access the PDF Version