Working with Widgets

4.1. To Select Widgets From the Palette Window

You can work with the widgets in the Palette window in the following ways:

Selection mode

To use selection mode, click on the Selector arrow. The pointer changes to an arrow to indicate that selection mode is active. In this mode, you use the mouse to select widgets in your project. You can then use the Properties window to edit the properties of the widgets.

You can also use the widget context menu to select a widget. Right-click on a widget to open the widget context menu.

You can add multiple widgets of a specific type from the Palette to your project by holding down the Control key when you select a widget. You need to click on the Selector arrow or another widget in the Palette to return to normal mode.

Widget placement mode

To use widget placement mode, select a widget in the Palette window. When you select most widgets, the pointer changes to a pointer-plus-cross. You can then place the widget inside containers, top-level widgets, and so on. After you place a widget, the mode returns to selection mode.

Top-level placement mode

To use top level placement mode, select a defined top-level widget in the Palette window. When you select a top-level widget in the Palette window, the widget appears immediately on your desktop. You can then edit the widget. After you select a top-level widget, the mode returns to selection mode.

4.2. To Organise Widgets In Your Project

You use widget containers, or boxes, to layout and organise widgets in your project window. You can choose the following widget containers from the Palette window:

  • Horizontal Box
  • Vertical Box
  • Table
  • Fixed Positions
  • Horizontal Button Box
  • Vertical Button Box
  • Horizontal Panes
  • Vertical Panes
  • Notebook
  • Frame
  • Scrolled Window
  • Viewport

You can nest boxes to create complex layout structures. When you create horizontal and vertical boxes, Glade asks you how many rows or columns to create initially, though rows and columns can easily be added or deleted later.

When you have created all the boxes you require, you can add specific widgets like labels, buttons, and more complicated widgets into the boxes. Notice that Glade packs widgets into the layout which eliminates a lot of tedious work. The use of boxes enables windows to change size to accommodate different size labels in different languages when the application is localised.

4.3. To Place a Widget on the Clipboard

To remove a widget from a parent and place the widget on the clipboard, select the widget then choose Edit ▸ Cut.

4.4. To Copy a Widget to the Clipboard

To copy a widget to the clipboard, select the widget then choose Edit ▸ Copy. The original widget remains attached to the parent.

4.5. To Paste a Widget From the Clipboard Into Your Project

To paste a widget that exists on the clipboard into your project, choose Edit ▸ Paste.

All widgets must have a unique name within Glade. If you cut a widget, and then paste the widget into your project, then the widget and all of the children of the widget keep their original names. If you copy a widget, or paste the widget multiple times into your project, then Glade generates new names for the widget copies.

4.6. To Delete a Widget

To delete a widget from the parent without moving the widget to the clipboard, select the widget then choose Edit ▸ Delete.

4.7. To Change a Property of a Widget

The property editor is used to edit the properties of a selected widget. To change a property of a widget, select the widget and then enter an appropriate value in one of the Property window's property fields.