4D v13.4OBJECT SET STYLED TEXT ATTRIBUTES |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
OBJECT SET STYLED TEXT ATTRIBUTES
OBJECT SET STYLED TEXT ATTRIBUTES
The OBJECT SET STYLED TEXT ATTRIBUTES command can be used to modify one or more style attributes in the form object(s) designated by object. If you pass the optional * parameter, this indicates that the object parameter is an object name (string). During execution, when the object has the focus, the command only applies to the object being edited and not to its data source (field or variable). The changes are only transferred to the source (and to any other objects using this same source) when the object being edited is validated either by losing the focus or with the Enter key. When the object does not have the focus, the command applies directly to the data source and the changes are immediately transferred to any other objects using the same source. Note: You can only use style attributes with Text type fields. Since Alpha type fields have a preset length, adding style tags would lead to a loss of data. The definition of an attribute is carried out via the insertion or modification of HTML style tags within the text (for more information about this point, refer to the Design Reference manual). Note that OBJECT SET STYLED TEXT ATTRIBUTES inserts style tags in all cases, even if the object designates text objects of the form that do not have the Multistyle property. The startSel and endSel parameters can be used to designate the selection of text to which to apply the style modification(s) within the object. In startSel, you pass the position of the first character to be modified and in endSel, you pass the position of the last character to be modified plus one (the last character passed is not included in the modification). You can pass 0 in endSel to designate automatically the last character of the text (pass 1 in startSel to designate the first character of the text). In attribName and attribValue, pass the name and the value, respectively, of the attribute to be modified. You can pass as many attribute/value pairs as you want. To specify the attribName parameter, use the predefined constants placed in the Multistyle Text Attributes theme. The value passed in the attribValue parameter depends on the attribName parameter:
Colors
In this example, we modify the size and color of the text as well as the bold and underline attributes of the characters 2 to 4 of the field: OBJECT SET STYLED TEXT ATTRIBUTES([MyTable]MyField;2;5;Attribute font name;"Arial";Attribute text size;10;Attribute underline style;1;Attribute bold style;1;Attribute text color;"Blue") After this command is executed, the OK variable is set to 1 if no error occurred; otherwise, it is set to 0. This is the case more particularly when style tags are not evaluated properly (incorrect or missing tags). In the case of an error, the variable is not changed. When an error occurs on a variable when text is being evaluated, 4D transforms the text into plain text; as a result, the <, > and & characters are converted into HTML entities. |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: 4D v12 SEE ALSO
FONT LIST TAGS multistyle, multi-style, multi style*** |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||