Skip to main content
Version: Next

HIGHLIGHT TEXT

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

ParameterTypeDescription
*Operator🡒If specified, object is an object name (string)
If omitted, object is a field or variable
objectField, Variable, Form object🡒Object name (if * is specified) or Enterable field or variable (if * is omitted)
startSelLongint🡒New text selection starting position
endSelLongint🡒New text selection ending position

Description

The HIGHLIGHT TEXT command highlights a section of the text 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.

If object is not the object currently being edited, it gets the focus.

Note: This command cannot be used with fields in a subform.

startSel is the first character position to be highlighted, and lastSel is the last character plus one to be highlighted. If startSel and lastSel are equal, the insertion point is positioned before the character specified by startSel, and no characters are highlighted.

If lastSel is greater than the number of characters in object, then all characters between startSel and the end of the text are highlighted.

Example 1

The following example selects all the characters of the enterable field [Products]Comments:

 HIGHLIGHT TEXT([Products]Comments;1;Length([Products]Comments)+1)

Example 2

The following example moves the insertion point to the beginning of the enterable field [Products]Comments:

 HIGHLIGHT TEXT([Products]Comments;1;1)

Example 3

The following example moves the insertion point to the end of the enterable field [Products]Comments:

 $vLen:=Length([Products]Comments)+1
 HIGHLIGHT TEXT([Products]Comments;$vLen;$vLen)

Example 4

See example for the FILTER KEYSTROKE command.

See also

GET HIGHLIGHT