Find restricted to the current card?

Peter Brigham MD pmbrig at gmail.com
Sun May 1 12:54:37 EDT 2011


On May 1, 2011, at 11:50 AM, James Hurley wrote:

> I have a field with the script:
> 
> on mouseUP
>   put the value of the clickline into tText
>   set itemdel to tab
>   put item 1 of tText into tText
>   find string  tText in field "thetext"
> end mouseUP
> 
> 
> When I click on a line in the field RR finds the string in the field "theText" and a second click on the same line finds the next instance of the string in the same field. 
> 
> But if, on subsequent clicks, it fails to find the string in the field "theText" on the current card, it goes looking for the string on any other card with a field named "theText"
> 
> Is there a way to do something like:
> 
>     find string tText in field "theText" ON THIS CARD
> 
> So that it will not jump to other cards containing a field of the same name and the same text. (Without having to go through the stack and rename fields so that there are no duplicates?)
> 
> In short, restrict the search to the current card.
> 
> Jim Hurley

Try this (untested, but should work):

on mouseup
   put the value of the clickline into tText
   set the itemdelimiter to tab
   delete item 2 to -1 of tText
   put the short id of this card into origCdID
   lock screen
   find string tText in fld "theText"
   if the short id of this card <> origCdID then
      go cd id origCdID
      beep
      find empty
   end if
end mouseup

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list