Skip to main content
Version: Next

GET HIGHLIGHT

GET HIGHLIGHT ( {* ;} object ; startSel ; endSel )

ParameterTypeDescription
*OperatorIf specified, object is an object name (string)
If omitted, object is a field or variable
objectField, Variable, anyObject name (if * is specified) or
Field or variable (if * is omitted)
startSelIntegerCurrent text selection starting position
endSelIntegerCurrent text selection ending position

This command is not thread-safe, it cannot be used in preemptive code.

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<="" pre=""></vlast)>

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