如何隐藏实时代码中的特定文本

时间:2015-04-17 12:36:34

标签: livecode

我希望看到替换正在发生的特定行。所有其他文本应采用隐藏格式。有可能吗?

 on mouseUp
   put the htmlText of field "MytextField" into myHtml
   set the caseSensitive to true
   put the field SRText into myArrayToBe
   split myArrayToBe by CR
   put the number of lines of (the keys of myArrayToBe) into myArraylength
   repeat with i = 1 to myArraylength 
      --return i
      put  myArrayToBe[i] into y
      split y by colon
      put y[1] into searchStr
      put y[2] into replaceStr
      if searchStr is empty then
         put the  0 into m
      else 
         replace searchStr with  "<strike><font bgcolor=" & quote & "yellow" & quote & ">" & searchStr & "</font></strike><font bgcolor=" & quote & "green" & quote & ">" & replaceStr & "</font>" in myHtml
      end if
   end repeat
   set the htmlText of fld "MytextField" to myHtml
   end mouseUP

1 个答案:

答案 0 :(得分:0)

我不清楚你想要做什么,但我认为你不想先'替换'。将myHtml转储到“MytextField”中,然后在该字段中使用find语法。它将滚动到找到的文本并在其周围绘制一个正方形,然后您可以使用foundtext,foundline,foundchunk来替换,突出显示,调暗所有其他文本或其他任何文本。