LIvecode中如何select一个带有特殊字符的单词

How to select a word with special characters in LIvecode

如何 select 带有特殊字符的单词(例如:usa-uk)。以下代码将 select 文本,但不会 select 像 usa-uk 这样的词。我如何更改我的代码

select the mouseText 

你 select 还好吗?例如,如果这是在字段脚本中:

on mousemove select the mouseText end mouse move

您将select输入光标下的文本。为了 select 复合文本,例如 "usa-uk",您必须对该文本片段进行分组。这将该片段的 textStyle 设置为 "link".

克雷格·纽曼

如果您的领域中没有大量文字,您可以使用:

on mouseMove
   if the mouseLoc is within the rect of me then
      put the mouseChunk into tChunk
      # Check if chars before or after is a "spacing char"
      put word 2 of tChunk into tstart
      put word 4 of tChunk into tEnd
      repeat with i = tStart down to 1 step -1
         if matchText(char i of me, "\s") then exit repeat
      end repeat
      put i+1 into tStart
      repeat with i = tEnd to the number of chars of me
         if matchText(char i of me, "\s") then exit repeat
      end repeat
      put i-1 into tEnd
      select char tstart to tEnd of me
   end if
end mouseMove