Versions 6.8 and 2003
The following method replaces a string that is being highlighted in an enterable field or variable.
` Project Method: Replace_HighlightedString
` Description: Replace the string that is being highlighted in
` an enterable text field or variable.
`
` Parameters: $1 - Pointer to an enterable field or variable
` $2 - A new string to replace.
C_POINTER($1;$area)
C_TEXT($2;$newstring)
C_LONGINT($startSel;$endSel)
$area:=$1
$newstring:=$2
GET HIGHLIGHT($area->;$startSel;$endSel)
If ($startSel<$endSel)
$area->:=Delete string($area->;$startSel;$endSel-$startSel)
$area->:=Insert string($area->;$newstring;$startSel)
HIGHLIGHT TEXT($area->;$startSel;$startSel+Length($newstring))
End if
Caution: Do not execute this method from an object that has the focusable option enabled. Otherwise, the enterable field or variable will lose its highlighted position.