igure 4: Glade Palette
When creating a Gnome interface, bear in mind that Gnome uses a container method for holding and placing its widgets. Each widget that you place in a window, cannot be placed directly in the window, but, instead, must be placed in a container. In fact, the key to designing a Gnome interface is to first select the appropriate container for the widget you want to add. For example, to place a button in a Gnome window, you first place a container for it on the window and then place the button in that container. Containers come in a variety of combinations. You can have several containers stacked on top of each other in rows (horizontal boxes), or set beside each other in columns (vertical boxes). Containers can be organized into tables, or you can create a container that supports fixed positions. When you place a container on a window, you will be asked to select the number of containers you want. For example, for containers that fill up rows the length of a window, you would select horizontal box container. When you place it on the window, you will be prompted to enter the number of rows you want. The different types of containers are displayed at the bottom of the GTK+ Basic Palette window, showing the outline formats for each. Figure 5 shows the containers currently available.
JJJ^^j JJJ d JJzd
Figure 5: Glade GTK+ containers
Keep in mind that, unless you select the Fixed Position container, the widget will automatically expand to fill the frame. For example, a button placed in a row container will fill the entire length of the window. This is helpful if you are selecting the kind of widget that would fit well into that container. For example, if you want to add a menu and a toolbar to a blank window, you would first select and place the horizontal boxes container and select three rows. Initially, all three rows will be evenly sized. Then you would click on the menu widget and place it on the first row. The row will contract to the size of the menu, and the same for the toolbar placed on the second row.
You can create complex combinations by placing one container inside another. For example, you could first create two row containers, placing a menu in one. Then place two column containers in the remaining row container. In one column, you could place several button-row containers and put buttons in them. The other column could hold a frame for displaying data.
Tip You can delete any widget, including containers, by right-clicking on them and selecting Delete from the pop-up menu.
To just place a widget anywhere on a surface, you would use the Fixed Positions container. With this container, you can then select any number of widgets, placing each at different places on the container space. You can move or resize the widget by selecting it to display the anchor points on its corners. Use these to resize it, or use click and drag on the selected widget to move it. In Figure 6, a Fixed Position container has been created and two widgets placed on it—a label with the text "Hello World" and a button with the text "Click Me".
Oiafr iBrä Concis Builu
Figure 6: Buttons and labels on Glade
Was this article helpful?