finding multiple keystrokes

Stephen Kramer steve at theschoolsystem.net
Thu May 4 10:44:58 EDT 2006


Thanks Brian!

Works perfectly.

Steve

> Date: Wed, 3 May 2006 21:27:34 -0700
> From: Brian Yennie <briany at qldlearning.com>
> Subject: Re: finding multiple keystrokes
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <88064cb39c39932cfbb60f7f983f1657 at qldlearning.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> 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
>




More information about the use-livecode mailing list