How to sort on keydown

Admin admin at mfelkerco.com
Wed Aug 3 13:52:07 EDT 2011


  

Chris, 

I did away with the drop down (which was not really a true
drop down since the revlet player cannot scroll drop down boxes in most
browsers), and switched to a option box instead. 

How would I do the
same thing (user clicks the option box and then presses say, the 'm" key
for March? 

Mike 

On Wed, 3 Aug 2011 10:00:27 -0400, Nonsanity wrote:


> Since sort will re-order the items, I think what you want is
"select". You
> are also sorting "items" which by default means the
chunks of text separated
> by commas (you can change the commas to any
other character by setting the
> itemDelimiter), but I'm guessing you
mean lines. If it actually IS items,
> replace "lines" with "items" in
the code below.
> 
> on keydown theKey
> show fld "MonthDropDown"
>
repeat with a = 1 to the number of lines in fld "MonthDropDown"
> if
char 1 of line a of fld "MonthDropDown" is theKey then
> select line a
of fld "MonthDropDown"
> exit repeat
> end if
> end repeat
> end
keydown
> 
> Does that do what you want? You might want to limit the
keys it works with
> by putting an if statement around the entire guts
of the handler like so:
> 
> if theKey > 64 and theKey < 91 then
> ...
>
end if
> 
> ~ Chris Innanen
> ~ Nonsanity
> 
> On Wed, Aug 3, 2011 at
2:24 AM, Admin wrote:
> 
>> Hello everyone. I wrote the following code:
on keydown show field "MonthDropDown" sort items of field
"MonthDropDown" by keydown letter end keydown It's wrong. I know it's
wrong. How do I make it right? (I want the drop down list to end up on
the letter of what the user pressed on keydown, so if they pressed 'd'
or 'D' I want "December" to become highlighted. Thanks everyone. Mike
_______________________________________________ use-livecode mailing
list use-livecode at lists.runrev.com [1] Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode [2]
> 
>
_______________________________________________
> use-livecode mailing
list
> use-livecode at lists.runrev.com [4]
> Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
>
http://lists.runrev.com/mailman/listinfo/use-livecode [5]

 


Links:
------
[1] mailto:use-livecode at lists.runrev.com
[2]
http://lists.runrev.com/mailman/listinfo/use-livecode
[3]
mailto:admin at mfelkerco.com
[4] mailto:use-livecode at lists.runrev.com
[5]
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list