4D v13.4

OBJECT GET STYLED TEXT ATTRIBUTES

Home

 
4D v13.4
OBJECT GET STYLED TEXT ATTRIBUTES

OBJECT GET STYLED TEXT ATTRIBUTES 


 

OBJECT GET STYLED TEXT ATTRIBUTES ( {* ;} object ; startSel ; endSel ; attribName ; attribValue {; attribName2 ; attribValue2 ; ... ; attribNameN ; attribValueN} ) 
Parameter Type   Description
Operator in If specified, object is an object name (string) If omitted, object is a variable or a field
object  Form object in Object name (if * is specified) or Variable or field (if * is omitted)
startSel  Longint in Start of text selection
endSel  Longint in End of text selection
attribName  Longint in Attribute to get
attribValue  Variable in Current value of attribute

The OBJECT GET STYLED TEXT 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.
If you omit the * parameter, this indicates that the object parameter is a field or a variable. In this case, you pass a field or variable reference instead of a string and during execution, the command returns information about this field or variable.

 

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).
If the values of startSel and endSel are equal or if startSel is greater than endSel (except if endSel value is 0, see above), an error is returned.
The startSel and endSel values do not take any style tags already present in the area into account. They are evaluated on the basis of raw text (text from which style tags have been filtered).

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.

Constant Type Value Comment
Attribute background color Longint 8 attribValue=Hexadecimal values or HTML color names (Windows only)
Attribute bold style Longint 1 attribValue=0: remove bold attribute from selection
attribValue=1: apply bold attribute to selection
Attribute font name Longint 5 attribValue=Font family name (string)
Attribute italic style Longint 2 attribValue=0: remove italic attribute from selection
attribValue=1: apply italic attribute to selection
Attribute strikethrough style Longint 3 attribValue=0: remove strikethrough attribute from selection
attribValue=1: apply strikethrough attribute to selection
Attribute text color Longint 7 attribValue=Hexadecimal values or HTML color names
Attribute text size Longint 6 attribValue=Number of points (number)
Attribute underline style Longint 4 attribValue=0: remove underline attribute from selection
attribValue=1: apply underline attribute to selection

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:

attribNameattribValue if attribute heterogenous in selection or no SPAN tags
Attribute background colorFFFFFFFF
Attribute bold style2
Attribute font name"" (empty string)
Attribute italic style2
Attribute strikethrough style2
Attribute text colorFFFFFFFF
Attribute text size-1
Attribute underline style2

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
Theme: Object Properties
Number: 1094

The OK variable is changed by the command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v12
Modified: 4D v12.1

 
SEE ALSO 

OBJECT SET STYLED TEXT ATTRIBUTES

 
TAGS 

multi-style, multistyle, multi style***