GET HIGHLIGHT
GET HIGHLIGHT ( {* ;} object ; startSel ; endSel )
Parameter | Type | Description | |
---|---|---|---|
* | Operator | → | If specified, object is an object name (string) If omitted, object is a field or variable |
object | Field, Variable, any | → | Object name (if * is specified) or Field or variable (if * is omitted) |
startSel | Integer | ← | Current text selection starting position |
endSel | Integer | ← | Current text selection ending position |
Description
The GET HIGHLIGHT command is used to determine what text is currently highlighted in object.
If you pass the optional * parameter, you indicate that the object parameter is an object name (string). If you do not pass the * parameter, you indicate that the object parameter is a field or variable. In this case, you pass the field or variable reference (form fields or variables only) instead of a string.
Note: This command cannot be used with fields in the List form of a subform.
Text can be highlighted by the user or by the HIGHLIGHT TEXT command.
The parameter startSel returns the position of the first highlighted character.
The parameter endSel returns the position of the last highlighted character plus one.
If startSel and endSel are returned equal, the insertion point is positioned before the character specified by startSel. The user has not selected any text, and no characters are highlighted.
If the object designated by the object parameter is not found in the form, the command returns -1 in startSel and -2 in endSel.
Example 1
The following example gets the highlighted selection from the field called [Products]Comments:
GET HIGHLIGHT([Products]Comments;vFirst;vLast)
If(vFirst < vlast)
ALERT("The selected text is:"+Substring([Products]Comments;vFirst;vLast-vFirst))
End if
Example 2
See example for the FILTER KEYSTROKE command.
Example 3
Modification of highlighted text style:
GET HIGHLIGHT(*;"myText";$startsel,$endsel)
ST SET ATTRIBUTES(*;"myText";$startsel,$endsel;Attribute underline style;1;Attribute bold style;1)
See also
FILTER KEYSTROKE
HIGHLIGHT TEXT
Keystroke
Properties
Command number | 209 |
Thread safe | ✗ |