Arrows Keys and List Fields

J. Landman Gay jacque at hyperactivesw.com
Fri Jan 11 13:33:25 EST 2008


Gregory Lypny wrote:
> Hello everyone,
> 
> I have a list field, and as I use the Up and Down keys, I want to 
> display the contents of individual lines in another field.  The list 
> field's handler below displays the lagged line and not the one that was 
> keyed to because the selected line doesn't change until the pass 
> arrowKey command is invoked and that has to happen at the end for the 
> line to change.
> 
> Not sure how to get what I want.
> 
>     Gregory
> 
> on arrowKey theKey
>   if theKey is "Up" or theKey is "Down"
>   then
>     put the value of the selectedLine of the target into fld "Display"
>     pass arrowKey
>   end if
> end arrowKey

I'd use the "selectionChanged" message handler instead of "arrowKey". 
This will trigger when the user changes the line by either arrow keys or 
mouse, so you only need one handler to catch both. Also, you won't need 
to trap for "up" or "down" because selectionChanged in locked list 
fields will only trigger with up or down arrow key presses.

I know the docs say this message isn't sent to fields when the arrowkey 
is used, but there's an exception in list fields, where it is.


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



More information about the use-livecode mailing list