Widgets

The widget is the basic building block of most X applications. A widget can be considered an object in the object oriented paradigm. A widget has certain properties, and it can have certain methods applied to it.

Some of the common properties associated with a widget are a window, a geometry, colors (forgound and background) and a position in the widget hierarchy. Not all widgets have all of these properties, but most of them do. The value of these properties are specified by the application resources (explained later).

Some of the common methods that can be applied to a widget are realize (create), resize, and repaint. Other methods may be available depending on the nature of the widget.

An application is built by combining widgets into a useful user interface. This combination is called the widget hierarchy and can be though of as a tree structure. Each application will have a widget tree that is specific (and probably unique) to that application.
Image of a simple X client to illustrate widgets

Identifying the widgets

Each type of widget is identified by a class. The class name of the widget usually described the function of the widget, such as Label, ComandButton, and ScrollBar. An application may have multiple instances of the same widget class.

In an application, each instance of a widget is identified by a unique name. The name should describe how the widget is being used, such as quitButton, helpButton, and fileMenu.

Viewing the widgets

Some programs are provided for working with the Athena Widgets. These programs show you the widget hierarchy in a couple of different formats, and allow you
to interactively manipulate them.

listres

This utility simply prints out each widget in the Athena widget set, and shows its ancestry.

viewres

This utility shows the widget ancestory graphically. It uses the Tree widget to display this information.

editres

Editres is an interactive tool that can be used to dynamically modify the properties of an Athena widget. Only applications built using the Athena widgets can utilize utility.

Editres can be used to identify a widget in the widget tree, and modify some properties of that widget.