Arrows Keys and List Fields
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Fri Jan 11 13:16:58 EST 2008
The more elegant solution indeed!
Really displeased for not having thought of it ;-)
LOL
Le 11 janv. 08 à 19:12, Richard Gaskin a écrit :
> Gregory Lypny wrote:
>> 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
>
> If you trap the selectionChanged message instead of arrowKey,
> you'll not only get the message when you want it but also have an
> update when the mouse is used to, from the same handler. You can
> also get the value of the selected line by using the hilitedText
> property:
>
> on selectionChanged
> put the hilitedText of the target into fld "Display"
> end selectionChanged
>
> Also, the "left" and "right" arrow keys have the same automatic
> behavior as "up" and "down" respectively, so this selectionChanged
> handler will handle those as well.
>
> --
> Richard Gaskin
> Managing Editor, revJournal
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list