"Find" Not Hilighting Found Text

Sannyasin Sivakatirswami katir at hindu.org
Fri Mar 19 22:07:31 EST 2004


[sending again because somehow this got tagged to be part of the 
"collisions" thread]

I thought I had this solved several years ago, but it's back: Find does 
not hilite  (put a box around) text on the first hit...

I put a lot of text matter, mostly ebooks repurposed from print 
versions, into Rev for fast searching. Break out entire chapters or 
part of chapters or numbered paragraphs to single cards and make a 
Table of Contents of these etc.

For searching I use a Find and Find Again pulldown menu (see scripts 
below)

Aside from the nuisance that the cmd-keys (Mac OSX) don't work in the 
IDE, even if you suspend it... another problem shows up even in a 
standalone: that is, that if you hit cmd-F, search for "task force"  my 
script does take me to the card and scrolls the card, but does not 
hilight the word... I have to hit cmd-G again, to get it to hilight the 
word again, the first instance on the card, as expected. Then, if I hit 
cmd-G again, it moves on to another card with an instance of "task 
force" but does not hilight the word.  You have to hit cmd-G again.

This may be a correlary bug to the one where pasting into a text field 
leaves you with no cursor, -- very disconcerting. The issue "smells"  
similar, the field is not being updated in the video card to show
a) the foundText box around text or
b) the cursor

any insights? I supposed i can use complicated offset search routine 
and force the text to be highlighted once the exact chunk is 
determined,, but I was thinking there might be a simple solution to 
make the engine's native  "find" command to perform as expected.

Button Name : "Find"

contents

    Find/F
    Find Again/G

Script:
on menupick tItemChosen
   switch tItemChosen
     case "Find"
       searchForIt
       break
     case "Find Again"
       doFind
       break
   end switch
end menupick

In the stack script:

global gLastFind
on searchForIt
   lock messages
## lock messages required if you want to  be able to search forward to 
the next instance
## but, maybe it is the problem also... not allowing the find to 
outline the find text.

   ask "Find:" with gLastFind
   if it is empty then exit searchForIt
   put it into gLastFind
   doFind
end searchForIt

on searchAgain
   doFind
end searchAgain

on DoFind
   lock messages
   find string gLastFind
   if the result is "Not Found" then
     answer quote&gLastFind&quote&" not found." with "Try Again" or 
"Cancel"
     if it is "cancel" then exit doFind
    searchForIt
   end if
end DoFind

TIA

Sivakatirswami
Himalayan Academy Publications



More information about the use-livecode mailing list