KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method that replaces a highlighted text in a 4D Write Pro area
PRODUCT: 4D Write Pro | VERSION: 16R4 | PLATFORM: Mac & Win
Published On: July 19, 2017

Here is a utility method that replaces a highlighted text in a 4D Write Pro area.

  // Method: wpReplace
  // Parameters
  // $1 - WP Area Object Name
  // $2 - New Text
  // ----------------------------------------------------

C_TEXT($1;$wpArea_t;$2;$newText_t)
C_LONGINT($start_l;$end_l)

If (Count parameters>=2)
  $wpArea_t:=$1
  $newText_t:=$2
  GET HIGHLIGHT(*;$wpArea_t;$start_l;$end_l)
  ST SET TEXT(*;$wpArea_t;$newText_t;ST Start highlight;ST End highlight)
  HIGHLIGHT TEXT(*;$wpArea_t;$start_l;$start_l+Length($newText_t))
End if


Related Tech Tip: Utility method to search for a string in a 4D Write Pro area