4D v13.4

GET HIGHLIGHT

Home

 
4D v13.4
GET HIGHLIGHT

GET HIGHLIGHT 


 

GET HIGHLIGHT ( {* ;} object ; startSel ; endSel ) 
Parameter Type   Description
Operator in If specified, object is an object name (string) If omitted, object is a field or variable
object  Field, Variable, Form object in Object name (if * is specified) or Field or variable (if * is omitted)
startSel  Longint in Current text selection starting position
endSel  Longint in 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 command FILTER KEYSTROKE.

Modification of highlighted text style:

 GET HIGHLIGHT(*;"myText";$startsel,$endsel)
 OBJECT SET STYLED TEXT ATTRIBUTES(*;"myText";$startsel,$endsel;Attribute underline style;1;Attribute bold style;1)

 
PROPERTIES 

Product: 4D
Theme: Entry Control
Number: 209

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: < 4D v6
Modified: 4D v12

 
SEE ALSO 

FILTER KEYSTROKE
HIGHLIGHT TEXT
Keystroke