[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Wednesday, 25 July 2001 | Author: Subhasish Ghosh |
Published to: develop_articles/Development Articles | Page: 2/3 - [Printable] |
GNOME Programming in Linux using GTK+
Ever wonder how those little garden Gnomes move around and stuff at night? It's because they are programmed, of course! In this article Linux.com asked Subhasish Ghosh to show us how to start programming our own Gnome applications using the GTK+ toolkit.
|
<< Page 2 of 3 >> | |
ContainersNext, we look into another vital component of GNOME programming: Containers. GTK+ uses containers a great deal because GTK+ is actually a "container-based" toolkit. That means we have a parent container within which we have to place our other widgets. Windows are single widget containers. Thus, the important point to keep in mind is that GTK+ utilizes invisible "packing boxes" that can hold multiple widgets to create windows layouts. These "packing boxes" are of two types: horizontal and vertical, created by using the functionsgtk_hbox_new and gtk_vbox_new ,
respectively. We will see these functions in action soon, in the
applications that we create later. For now, let's take a look into
the parameters of these two functions:
ButtonsNext we come to another very vital component: Buttons. GTK+ provides four different kinds of buttons:
Creating radio buttons is very similar to check boxes, and all that we need to do extra is to specify a group for the radio button to belong to. Radio buttons are derived from check buttons, which are derived from toggle buttons, so this means that we have the same set of functions to read and modify their state and also use the same old events. Please note: For more information of specific functions, consult the GTK+ Reference Documentation available at: http://www.gtk.org Entry WidgetsFor creating single-line text widgets, which are commonly called "Entry widgets", we utilize a function calledgtk_entry_new(
) . Entry widgets are mainly used to enter small amounts of
information. Let's take a look at a program that creates a "Login
Window", and outputs the password field, when the activate signal
occurs, when the button is pressed. Type in the following and
execute the program as has been explained above.
When executed this program will cause a login window to appear on the screen. Type in any text (assuming it to be a password), and press enter. Observe what happens.
| |
<< Page 2 of 3 >> |