Arrow Keys on List Fields - The Selected/hilited Line
Marty Knapp
martyknappster at gmail.com
Fri Apr 22 18:15:58 EDT 2016
Perhaps there's a better way but here's what I do - I put the following
in the card script and then my list processing in the list field itself:
on arrowKey which
put word 2 of the selectedLine of fld "UserList" into tSelectedLine
if tSelectedLine is empty then exit to top
if which is "up" then
if tSelectedLine >1 then --nothing less than line 1
select line (tSelectedLine-1) of fld "UserList"
send mouseDown to fld "UserList" --put list processing here
end if
else if which is "down" then
if tSelectedLine <= the number of lines of fld "UserList" then
select line (tSelectedLine+1) of fld "UserList"
send mouseDown to fld "UserList" --put list processing here
end if
end if
end arrowKey
Best regards,
Marty
> If you use the arrow key on a list field, the selected line in the fld is the line that was selected before the arrow key
>
> So if you traverse a list up and down with the arrow keys, the selected line is always “one line behind” so to speak
>
> on arrowKey
> put value (the selectedline of me) # is not the line you land on
> pass arrowkey
> end arrowkey
>
> Is this a bug? If not a bug is there a simple way to get the value of the line the arrow key landed on and not the one that it just left behind? I can resort to parsing the line, determining if the user when up or down and then adding and subtracting 1… but that seems very hacky… is there a simpler way?
>
> BR
> _______________________________________________
> 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