This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
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, Form object |
![]() |
Object name (if * is specified) or Field or variable (if * is omitted) | |||||
startSel | Longint |
![]() |
Current text selection starting position | |||||
endSel | Longint |
![]() |
Current text selection ending position | |||||
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.
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
See example for the FILTER KEYSTROKE command.
Modification of highlighted text style:
GET HIGHLIGHT(*;"myText";$startsel,$endsel)
ST SET ATTRIBUTES(*;"myText";$startsel,$endsel;Attribute underline style;1;Attribute bold style;1)
Product: 4D
Theme: Entry Control
Number:
209
Created: < 4D v6
Modified: 4D v12
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)