finding multiple keystrokes

Brian Yennie briany at qldlearning.com
Thu May 4 00:27:34 EDT 2006


Stephen,

How about something along the lines of:

constant keyThreshold = 500
local findString, lastKeyTime

on keydown key
   if (lastKeyTime is empty) OR (the milliseconds - lastKeyTime > 
keyThreshold) then
       put key into findString
   else
      put key after findString
   end if
    find  normal findString in  field "list"
    put the milliseconds into lastKeyTime
end keydown

This is top-of-the-head untested, but the idea would be to track the 
time at which a key was pressed, and if another key is pressed quickly 
enough (with the keyThreshold), append that key to the find string 
instead of replacing it.

HTH,
Brian

> the following will select, in a list field, only the first item that 
> starts with the first pressed key:
>
> on keydown key
> 	find  normal key in  field "list"
> end keydown
>
> but if field 'list' contains:
>
> abc
> agh
> aty
>
> how can I make it so that the third line will be selected if the user 
> presses "at"?
>
> Thanks,
>
> Steve
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list