selecting from a list with aid of keyboard

J. Landman Gay jacque at hyperactivesw.com
Thu May 5 16:29:15 EDT 2005


On 5/5/05 10:22 AM, Kurt Kaufman wrote:

> I know that this issue was addressed sometime in the
> last couple of years, but I can't seem to locate it:
> 
> When selecting a single line from a scrolling list
> (this being a Rev list, not the OS file selection
> box)it would be useful to enter 1-3 keys to have the
> field scroll to the entered letter, or letters. 
> 
> Could someone point me to the discussion of that
> subject?

Here's mine (watch for line wrap):

local lOldTicks,lUserKeys

on keyDown  whichKey -- select from keyboard
   -- J. Landman Gay, 1990, modified for Revolution: 2003
   if (the selectedField is not "") or (charToNum(whichKey) is among the 
items of "28,29,30,31") -- arrow keys
   then pass keyDown
   if the ticks - lOldTicks > 60 then put "" into lUserKeys
   put whichKey after lUserKeys
   put return & fld 1 & return into tListText
   get lineoffset(cr&lUserKeys,tListText)
   if it > 0 then set the hilitedlines of fld 1 to it
   put the ticks into lOldTicks
end keyDown


This allows you to type more than just the first character of a line to 
hone in on an exact line match. If the user pauses for more than a 
second (60 ticks,) then the collected keystrokes are abandoned and the 
search starts over. You can adjust the timing by changing the "60" to 
something else.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list