4D v16.3ST GET ATTRIBUTES |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
ST GET ATTRIBUTES
ST GET ATTRIBUTES
The ST GET ATTRIBUTES command is used to recover the current value of a style attribute in a selection of text of 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, if the object has the focus, the command returns information about the object being edited; however, when the object does not have the focus, the command returns information about the data source (field or variable) of the object. The startSel and endSel parameters are used to designate the text selection of the object from which the style attribute is to be read. Pass the position of the first character of the selection in startSel and the position plus one of the last character of the selection in endSel. 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). 4D provides predefined constants so that you can designate the selection limits automatically in the startSel and endSel parameters. These constants are found in the "Multistyle Text" theme:
(*) You must pass an object name in object to be able to use this constant. If you pass a reference to a field or variable, the command is applied to all the text of the object. Pass the name of the attribute to get in the attribName parameter and pass a variable which must recover the current value of the attribute in the attribValue parameter. To specify the attribName parameter, you must use one of the constants of the Multistyle Text Attributes theme.
You can pass as many attribute/value pairs as you want. If the value of the attribName attribute is the same for all of the selection, it is returned in attribValue. If this value is different or if object does not contain SPAN tags, the following values are returned:
Given a [Table_1]StyledText field displayed in a form. The object has the Multistyle property and is named "StyledText_t". You want to get the highlighted text as well as the status of the Bold style attribute. You can proceed in two different ways depending on whether you use the object name or the field reference.
$text:=ST Get text(*;"StyledText_t";ST Start highlight;ST End highlight)
GET HIGHLIGHT([Table_1]StyledText;$Begin_l;$End_l) 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.
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v12 TAGS multi-style, multistyle, multi style ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||