How to sort on keydown

dunbarx at aol.com dunbarx at aol.com
Wed Aug 3 15:35:56 EDT 2011


I don't think an option menu responds well to keypresses, whether or not the user has clicked there or not. I don't see any messages sent at all.


I loaded one with a few lines, "A" in the first, "B" in the second, etc.When I clicked in the menu, displaying the contents, and then trying a keypress that corresponded with one of the letters, I got odd behavior. Sometimes it seemed to work, mostly not.



Anyone know if I am right about this?


If so, you will need to build your own control, easy and fun to do.


Craig Newman





-----Original Message-----
From: Admin <admin at mfelkerco.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Aug 3, 2011 9:54 am
Subject: Re: How to sort on keydown


  

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
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 




More information about the use-livecode mailing list