Part 4a

Gtk Entry Widget

GtkEntry Widget

  1. Save tutorial-3.glade as tutorial-4.glade and we will make some changes to it.

    1. First remove the label widget from the center of the vertical box container.

    2. Next add a vertical box to the center with 2 items.

    3. Next in the top box add a table with 2 rows and 4 columns.

    Your project should look like this now.

    images/glade-04-01.png
  2. Next we will add some Label and Text Entry widgets and a Button widget as shown in the following image. Hold down the Ctrl key to select then paste multiple copies of a widget.

    Your project should look like this now.

    images/glade-04-02.png
  3. Next we will change the text in the Label: field of our labels and the button to match the following screen shot. Just delete the text from the two blank ones as they are just used as a filler.

    Your project should look like this now.

    images/glade-04-03.png
  4. Next we will add a unique name and a signal to our button.

    1. Change the button Name: to sfm_button.

    2. Add the on_sfm_button_clicked signal to the GtkButton clicked signal handler and don’t forget to press the enter key so the signal is saved.

    3. Change the name of the blank label under RPM to result1.

    Your project should look like this now.

    images/glade-04-04.png
    images/glade-04-05.png
    Figure 1. Unsaved and Saved
  5. Now for some clean up work.

    1. For each item in the table in the Packing tab de-select the Vertical options: Expand.

    2. Change the Width in Characters: to 8 for the blank label.

    Your project should look like this now.

    images/glade-04-06.png
  6. Click on the label in the bottom half then in the General tab under Edit label appearance click on the ellipse for the Label: box and add the following text.

    Enter the SFM (Surface Feet per Minute)
    and the cutter diameter.
    Press the Calc button to see the
    recommended cutter RPM.

    Your project should look like this now.

    images/glade-04-07.png

Ok save the file as 'tutorial-4.glade and we are done.