Scroll to -- another newbie question

Klaus Major klaus at major-k.de
Fri Jun 6 17:56:01 EDT 2003


Hi Duane,

> I am programming a dictionary.  I would like my find field to work like
> the "scroll to" function on the Transcript Language Dictionary. Trouble
> is I can't seem to figure out how to make that work. Can anyone give me
> any hints?

Yo :-)

Put this into the script of your find fld:

on keyUp
   put me into searchstring
      put lineOffset(return & searchstring, field "dictionary") into lo
      ### find the line with the entered char(s)...
      set the scroll of field "dictionary" to lo * the effective 
textHeight of field "dictionary"
      ## scroll to that line...
     ## you may need to adjust he name of the fld "dictionary"
   end if
   if (lo = 0) and (me <> empty) then
     ## no match AND an entry
     beep 1
     ## complain ;-)
     delete last char of me
    ## another chance for the user ;-)
     keyUp
    ## find again...
   end if
end keyUp

Works very fast, even with >1000 lines...

> Thanks.

You're welcome :-)

Hope that helps

> Duane Poncy

Have a nice weekend.


Regards

Klaus Major
klaus at major-k.de




More information about the use-livecode mailing list