Anyway, given some limitations of option menus, I decided to create a list field that would work like an option menu. The first task was moving the selection to whatever the user typed. I was amazed that I could get something that seemed to work with just 3 lines of code:
Code: Select all
local typedChars
on keyup theKey
put theKey after typedChars
select line lineoffset(typedChars,me) of me
end keyup
Code: Select all
local typedChars, timeout
on keyup theKey
if the seconds - timeout > 1 then put empty into typedChars
put theKey after typedChars
select line lineoffset(typedChars,me) of me
put the seconds into timeout
end keyup
Chase Checking
Checks to Deposit
...then typing "che" will *not* go to the second line, since lineoffset matches the 2nd word of the 1st line.
So, as a complete solution, matching only the beginning of lines:
Code: Select all
local typedChars, timeout
on keyup theKey
if the seconds - timeout > 1 then put empty into typedChars
put theKey after typedChars
lock screen -- greatly speeds things up on fields with lots of lines
repeat with x = 1 to the number of lines of me
if line x of me begins with typedChars then set the hilitedline of me to x
end repeat
put the seconds into timeout
end keyup