Working with words and text

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
JNetto
Posts: 1
Joined: Thu Apr 16, 2015 2:31 am

Working with words and text

Post by JNetto » Thu Apr 16, 2015 2:48 am

How can I scroll down a list (in alphabetical order) to the corresponding position of a word being typed in a second field? (i.e. as I type a word into "field1" the list on "field2" is scrolled to the corresponding letter typed. FIRE --- When "F" is typed the list goes to the first word starting in "F", when "I" is typed ("FI") then it moves to the first word starting in "F" followed by "I", and so forth....)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: Working with words and text

Post by dunbarx » Thu Apr 16, 2015 5:11 am

Hi.

Many ways to do this. Try, in the field script:

Code: Select all

on keyUp tkey
   if the length of me >= 3 then
      get lineOffset(me,fld 1)
      put it && it * the textHeight of fld 1 --just to see what is going on
      set the scroll of fld 1 to it * the textHeight of fld 1 - the textHeight of fld 1
   end if
end keyUp
Now you have to make sure that there is a valid textHeight property in your field. This is not necessarily set by default. Why test after three chars? What about backspacing? Why knock off one line in the scroll? Could you do this with the "find" command? Why so many questions?

Craig Newman

Post Reply