Page 1 of 1

shift-up/down arrow in list/table should add to selection

Posted: Mon Nov 03, 2008 10:06 pm
by billworld
A user should be able to use the up/down arrows to navigate lists/tables and while holding down the shift key the selection should be added to.

This should work by default, but, doesn't.

Can it be coded in?

Posted: Mon Nov 03, 2008 10:24 pm
by Mark
Hi Bill,

Yes, it can be done.

Code: Select all

on arrowKey theKey
   if the shiftkey is down then
      if theKey is down then
         put the hilitedLines of the selectedField into myLines
         if myLines is not empty then
            put comma & max(myLines)+1 after myLines
            set the hilitedLines of the selectedField to myLines
         end if
      else if theKey is up then
         put the hilitedLines of the selectedField into myLines
         if myLines is not empty and item 1 of myLines is not 1 then
            put max(1,min(myLines)-1) & comma before myLines
            set the hilitedLines of the selectedField to myLines
         end if
      end if
   else
      -- put there what you want to do if the
      -- shiftKey is up
      pass arrowKey
   end if
end arrowKey
This script works fine with a list field. You might need to tweak it a bit to make it work with your table field. Also, you might need to change selectedField with target, depending on what you do with the script exactly and where you keep it.

Best,

Mark

Posted: Tue Nov 04, 2008 12:04 am
by billworld
Thanks Mark.
Mark wrote:Hi Bill,

Yes, it can be done.