Page 1 of 1

Working with words and text

Posted: Thu Apr 16, 2015 2:48 am
by JNetto
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....)

Re: Working with words and text

Posted: Thu Apr 16, 2015 5:11 am
by dunbarx
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