Chapter 5. Content objects
Prev | Part II. Reference | Next

## Chapter 5. Content objects

- ``XXE_install_dir`/demo/form-sampler.xml` is used to demo how standard controls such as buttons, check boxes, combo boxes, text fields, etc, can be embedded in the styled view. The CSS style sheets used by this demo are found in sub-directory ``XXE_install_dir`/demo/form-sampler/`.

- Most pseudo-functions create objects which can be styled at the object level. Styles are specified using `key`, `value` pairs where `key` is the name of a style property (example: font-size) and `value` is the value of a style property (example: smaller).

  Example:

      text-field(columns, 10,
                 background-color, white,
                 color, black)

- Shorthand properties cannot be used to specify style parameters as described above.

  Example: padding-top, padding-left, padding-bottom, padding-right must be used rather than the single shorthand property padding.

- The above example is conceptually equivalent to (illegal CSS):

      { text-field(columns, 10);
        background-color: white;
        color: black; }

  It is important to keep this is mind because it explains why you can specify:

      text-field(columns, attr(cols),
                 background-color, white,
                 color, black)

  but not:

      text-field(columns, 10,
                 background-color, white,
                 color, attr(foreground))

  The `attr()` construct can only be used in the value of property `content`: therefore it is not possible to specify "`color: attr(foreground);`".

- All pseudo-functions generating controls (text-field, list, etc) also support the following color specifications:

  Key | Value | Default | Description
  --- | --- | --- | ---
  missing-color | Color | rgb(0,128,128) | Foreground color used by the control when attribute or element value is missing. Therefore, this color is used when drawing default value.
  missing-background-color | Color | None (no special background color) | Background color used by the control when attribute or element value is missing. Therefore, this color is used when drawing default value.
  error-color | Color | rgb(128,0,0) | Foreground color used by the control when attribute or element value is invalid or when control is not well suited to edit this kind of value.
  error-background-color | Color | None (no special background color) | Background color used by the control when attribute or element value is invalid or when control is not well suited to edit this kind of value.

  Example:

      text-field(columns, 10,
                 missing-color, gray)

- All pseudo-functions generating content (except icon() and xpath()) accept attr() and xpath() values as well as literal values for their parameters.

  Example:

      text-field(columns, 10)

      text-field(columns, attr(cols))

      text-field(columns, xpath("5 + 5"))

- Most pseudo-functions are shorthand notations for `gadget(`interface_name`)`. See gadget.

  For example, `collapser()` is a shorthand notation for `gadget("com.xmlmind.xmledit.form.Collapser")`, `command-button()` is a shorthand notation for `gadget("com.xmlmind.xmledit.form.CommandButton")`, etc.

Prev | Up | Next
Part II. Reference | Home | 1. add-attribute-button