HPlogo Using the X Window System > Chapter 5 Application Resources

Syntax of Resource Specifications

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

Resource files are text files. They must obey the following syntax rules:

  • Each resource specification must be on a separate line. If the last character on a line is a backslash (\), the new-line following the backslash is ignored and the resource specification is assumed to continue on the next line.

  • To add comments to resource files:

    • Use the exclamation (!) character. Anything to the right of the ! is interpreted as a comment. This is the preferred way of commenting all or portions of lines.

    • You can place a pound (#) character in column 1. This makes the entire line a comment. Keep in mind that you must use the xrdb option -nocpp when loading a commented resource to avoid it being interpreted as a preprocessor directive.

  • The resource name is separated from the value by a colon :) and optional spaces or tabs.

The general syntax for specifying a resource for a client is:

[ { client_name client_class } ] * resource: value

For example:

   hpterm*background:      skyblue

sets the background color of the hpterm window to skyblue.

Trailing blanks in a resource value are parsed and therefore can cause errors to occur. For example, if you inadvertently included a blank after "skyblue" in the example above, several warning messages appear when the program using the resource definition is run:

   Warning: Color name "skyblue " is not defined

   Warning: Cannot parse default background color spec

Certain clients allow you to set resources for particular parts of the client. For example,

   hpterm*scrollBar*background:    mediumblue

sets the scrollbar on hpterm windows to mediumblue.

© 1995 Hewlett-Packard Development Company, L.P.