How to search?

André.Bisseret Andre.Bisseret at inria.fr
Mon Jun 26 07:26:56 EDT 2006


Hi Felix,
I had a similar problem, when programming my last stack, on Mac OS X,  
10.4.6; Rev 2.6.1

In this stack, I search the field of one card for all occurencies of  
a textToFind (one word or phrase), in this card only (in order to  
highlight all these occurencies).
Like you, I don’t want the "find" be skipping to next cards.
I remember that I tried « fld of this cd » but it did not work.

So,  thanks to several members of this list (specially Jacque Landman  
Gay), below is how I proceed.

Hope it helps

Best regards from Grenoble
André

1-    ordinarily, all cards in my stack have their dontSearch  
property set to true
2-    But for other functions, I need search cards : so I have two  
handlers in the stack script I can call when necessary :
(I translate roughly certains terms from french)

on permitSearch
  put the cardNames of this stack into cardsList
   repeat for each line tCd in cardsList
     set the dontSearch of tCd to false
   end repeat
end permitSearch


on resumeDontSearch
   put the cardNames of this stack into cardsList
     repeat for each line tCd in cardsList
     set the dontSearch of tCd to true
   end repeat
end resumeDontSearch

When on the right card, my handler is :

on highLighting
    repeat
       find whole textToFind
       if the result is "not found" then exit repeat
       set the backgroundColor of the foundText to "Burlywood1"
    end repeat
end hithLighting

In order to be able to execute this handler on the current card only,  
I have 2 other handlers in the stack script :

on preOpenCard
   then set the dontsearch of this cd to false
end preOpencard

on closeCard
   set the dontsearch of this cd to true
end closeCard
  -------------------------------------------------------------

Le 26 juin 06 à 10:33, Felix Theissen a écrit :

> Hi,
>
> I have a problem, I want to search a shared field for
> all occurencies of TextToFind.
> But what happens is:
> if I search with find chars, after finding all
> occurencies of TextToFind in the first card it skips to
> the next card and find the same TextToFind places
> in the shared field there. Setting the dontsearch propertys
> of all cards but the current one to true does not change anything.
> How can I achieve my goal to search the shared text field
> only in the current card?
>
> Felix
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list