Using an index field

David Squance squance at elkvalley.net
Thu Jan 27 01:03:22 EST 2005


On Jan 26, 2005, at 9:17 PM, Sarah Reichelt wrote:

>> Thanks for the reply.  The contents are a single field.  There's only 
>> one card, and the index field and contents field are about all there 
>> is.  Just a title and a 'put away' button.  The script for the index 
>> field is:
>>
>> on mouseup
>>   put the value of the clickline into tFindText
>>   if  tFindText contains "overview" then find "overview" in fld 
>> "contents"
>>   else find whole tFindText in fld "contents"
>> end mouseup
>>
>> The index is generated by hand.  It's not a big deal, but when the 
>> last foundchunk (or line) is somewhere in the middle or near the 
>> bottom and a line in the index field that is above the last one is 
>> clicked, nothing happens.  It takes a second click for it to do 
>> anything.  I was hoping there was a tip someone could offer to script 
>> around that.
>> Dave
>>
> When you do a find, rev puts a box around the found text. if you then 
> do "find empty" it gets rids of the box and resets the find position. 
> I think this might be the workaround you are looking for.
>
> Alternatively, consider using lineOffset to get the relevant line 
> number and then set the vScroll of the field to the number of the line 
> * the textHeight.
>
> Cheers,
> Sarah

Thanks, Sarah.  That works, but I think I'll have a look at the 
lineoffset function, anyhow.
Dave



More information about the use-livecode mailing list