managing object focus via cursor keys

I’m trying to find out how to utilize the cursor keys to move from text field to text field within a window. I have a set of fields in a window, and want to be able to use the up-arrow cursor key to move up a row, the down-arrow cursor key to move down a row, and the left/right cursor keys to act as backtab/tab keys when the insertion point is positioned at the beginning/end of a field.

By way of illustration, envision a 3 x 3 grid of test fields, named “fld01” through “fld09”. The objective here is to be better able to mouselessly navigate through the fields, without having to repeatedly tab to get from field to field.

A related extension of this question involves automatically spilling over from one field to the next as the coded maximum number of characters in each field has been reached. For instance, if each field is to contain 3 characters, typing 123456 would distribute the characters into two fields, with 123 in the first field and 456 in the next field.

Any suggestons/examples would be most appreciated.