Next Prev Up

13.4.2 Matching Resource Names

The resource lookup algorithm searches a specified resource data base and returns the value for the resource binding whose resource name is the closest match to a given complete resource name and class. The intent of the lookup algorithm is to formalize an intuitive notion of the closest match.

Precedence is given to a match which begins higher in the parent-child contact hierarchy. This allows a resource binding with a partial name to define a resource value shared by all members of a window subtree. For example, suppose the resource database contained the following resource bindings:
Resource Name Resource Value
(mail * background) 'red
(* reply background) 'blue

Suppose an application program searched by using the following complete resource name:

(mail screen-1 reply background)

then the closest matching value returned would be 'red.

Precedence is given to the more specific match. A name match is more specific than a class match. Either a name or class match is more specific than a wildcard match. For example, suppose the resource database contained the following resource bindings:
Resource Name Resource Value
(mail * background) 'red
(mail * fill) 'blue

Suppose an application program searched by using the following complete resource name and complete resource class:

(mail screen-1 reply background)
(application root button fill)

then the closest matching value returned would be 'red . However, suppose the resource database contained the following resource bindings:
Resource Name Resource Value
(mail * background) 'red
(mail * button background) 'blue

then the closest matching value returned would be 'blue .


Next Prev Up
© 1988, 1989 Texas Instruments Incorporated
Conversion to HTML made by Gilbert Baumann.
Last build: Tue Dec 16 23:30:42 1997