How to stay on a card when repeating a « find »

André.Bisseret Andre.Bisseret at inria.fr
Sat Feb 4 09:29:41 EST 2006


Hi !
I have a background field that displays different texts on the 
different cards of the background.
I need to find all the occurrences of one word (or string) on one card 
only, in order to highlight each occurrence (set the backgroundColor).
So, when there is no more occurrence of a word on the current card, I 
must prevent the find to proceed on following cards.
Here is my current solution :
----------------
on highlightString thisCard
Global myWords -- several words or strings separated by commas
   put the name of this cd into currentCard
   repeat for each item i in myWords
     repeat
       find whole i
       if the name of this cd is currentCard then
         set the backgroundColor of the foundText to "Burlywood1"
       else
         go to currentCard
         exit repeat
       end if
     end repeat
   end repeat
end highlightString
------------------
Seems to work but not very nice ! because each time the "find" proceeds 
to another card I must « lead it back » to the right card (« go to 
currentCard »).

It seems to me that using « offset » would lead to a rather heavy 
handler  :-((

Any better idea welcome !

all the bests from Grenoble
André





More information about the use-livecode mailing list