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 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).
- the Automatic style sheet constant from the "Font Styles" theme in order to apply the "Automatic" style sheet.
- an empty string ("") so as to not apply the style sheet to the object.
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 or OBJECT SET FONT 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.