Find Command

Dave Cragg dave.cragg at lacscentre.co.uk
Thu Aug 2 07:05:12 EDT 2007


On 2 Aug 2007, at 03:59, RG Teeter wrote:

>
> The handler below:
>
>    on mouseUp
> 1     select the clickline
> 2     put the selectedtext into wordToFind
> 3     find string wordToFind in field "TestFld2"
> 4     put wordToFind & the result
> 5     find string "Cafe (das)" in field "TestFld2"
>   end mouseUp
>
> line 5 works as expected.
> line 3 returns "Not Found"
>
> Why?

Line 2 above will put a "return" character (numToChar(10) at the end  
of wordToFind (except when clicking the last line). The "find string"  
method doesn't allow return characters. Also, the find command  
searches forwards from the previous find, so subsequent clicks may  
not give what you want.

A crude approach:

on mouseUp

   select the clickline
   put the selectedtext into wordToFind
   if charToNum(char -1 of wordToFind) = 10 then
     delete char -1 of wordToFind
   end if
   find empty ## clear previous finds
   find string wordToFind in field 1
   put wordToFind & the result
end mouseUp


Cheers
Dave



More information about the use-livecode mailing list