Skip to main content
Version: Next

OBJECT SET STYLE SHEET

OBJECT SET STYLE SHEET ( {* ;} object ; styleSheetName )

ParameterTypeDescription
*OperatorIf specified, object is an object name (string)
If omitted, object is a field or variable
objectanyObject name (if * is specified) or
Field or variable (if * is omitted)
styleSheetNameTextName of style sheet

This command is not thread-safe, it cannot be used in preemptive code.

Description

The OBJECT SET STYLE SHEET command modifies, for the current process, the style sheet associated with the object(s) designated by the object and * parameters. A style sheet modifies the font, font size and (except for automatic style sheets) font style.

Passing the optional * parameter indicates that the object parameter is an object name (string). If you do not pass this parameter, it indicates that the object parameter is a field or variable. In this case, you pass a field or variable reference instead of a string (field or variable object only).

In the styleSheetName parameter, you pass the name of the style sheet to be applied to the object. You can also pass either:

  • the name of an existing style sheet (if the style sheet does not exist, an error is returned, that you can intercept using a method installed by the ON ERR CALL command),
  • an empty string ("") so as to not apply the style sheet to the object, or
  • one of the following constants found in the "Font Styles" theme in order to apply an automatic style shee:
ConstantTypeValueComment
Automatic style sheetText__automatic__Used by default for all objects
Automatic style sheet_additionalText__automatic_additional_text__Supported by static text, fields and variables only. Used for additional text in dialog boxes.
Automatic style sheet_mainText__automatic_main_text__Supported by static text, fields and variables only. Used for main text in dialog boxes.

If a style sheet was already associated with the object in Design mode, calling this command replaces it for the current process.

During the session, if you use the ST SET ATTRIBUTES, ST SET TEXT, OBJECT SET FONT or OBJECT SET FONT SIZE commands on the object in order to modify its font or font size, the reference to the style sheet is automatically deleted from the object -- even if you assign the same attributes as those of the style sheet. However, if you modify the style (bold, italic, etc.), for example using the ST SET ATTRIBUTES or OBJECT SET FONT STYLE commands, these new properties are added to the style sheet for the duration of the session.

Compatibility Note

In project architecture, only the three automatic style sheets are supported by this command.

See also

Font Styles
GET STYLE SHEET INFO
LIST OF STYLE SHEETS
OBJECT Get style sheet