Understanding resources

Using delimiters in resource specifications

Components of a resource specification are separated with delimiters, which are also known as ``bindings''. The following delimiters can be used:

The asterisk is a wildcard character and signifies that there can be any number of levels in the widget hierarchy between the two surrounding components. On the other hand, the dot indicates that the components must be next to each other in the hierarchy.

If you want to specify tight bindings, you must be very familiar with the widget hierarchy; it is easy to use these bindings incorrectly.

For example, the following resource specification, indicating that xterm windows should be created with a scroll bar, does not work:

   XTerm.scrollBar: true
This specification ignores the widget hierarchy of xterm, in which the VT100 window is considered one widget, the Tektronix window another, and the menus a third. To configure xterm to use a scroll bar using tight bindings, you would need to specify:
   XTerm.VT100.scrollBar: true
Rather than decipher the widget hierarchy of a client and risk making a mistake, it is far simpler to use the asterisk delimiter in your resource specifications:
   XTerm*scrollBar:  true
The asterisk, acting as a wildcard, tells the resource manager to locate any widgets in xterm's widget hierarchy that support a scroll bar and assign a scroll bar to them.

NOTE: In an application that supports multiple levels of widgets, you can mix loose and tight bindings. However, it is generally recommended that you use the asterisk delimiter, even in resource specifications for ``simple'' clients. This is because clients can change from release to release, incorporating new widgets in the hierarchy. Using loose bindings ensures that your resource specifications will work on future versions of a client.

Next topic: Specifying values in resource specifications
Previous topic: Using classes and instances in resource specifications

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003