Make down arrow behave like tab key

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu Apr 14 14:42:36 EDT 2005


On Thu Apr 14 Kaveh Bazargan kaveh at river-valley.com wrote:

> I have several fields in a stack and I want to be able to navigate through
> them using up and down arrow keys (I find shift tab not friendly). So how
> can I make down arrow act like tab, and on up arrow act like shift-tab?
> I have tried
>
> on arrowKey theKey
>     if theKey is "down" then
>       tabKey
>     end if
>   end if
> end arrowKey
>
> But tabKey handler is not found. Also tried
>
> send tabKey to fld ...
>
> etc.
> -- 
>
> Kaveh Bazargan



Seems to me you cannot use "tabkey" or "send tabkey" inside another 
handler. Someone from the Rev team should comment on this as there is no 
exact information in the docs or at least I can't find it.

Put this into your card script:

"on arrowkey thekey
  put the number of fields into FNumber
  if thekey is "down" then
    put word 1 of the focusedobject into Tobject
    if tobject is among the items of "card,button,graphic,image" then
      # add more control categories that could receive the focus to the 
items
      focus on field 1
    else if tobject is "field" then
      put word 3 of the focusedobject into IDNO
      put the number of field ID IDNO into tNumber
      if tNumber = FNumber then focus on field 1
      else
        focus on field (tNumber + 1)
      end if
    end if
  end if
end arrowkey"

Although somewhat complicated, it should work.
Change and add to the script accordingly when you want "arrow up" act 
like shift-tab, too.


Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>




More information about the use-livecode mailing list