>>>I am trying to automate the movement of the cursor in a grid. After the user enters data in the default textbox of column 3, I want the cursor to stay in this colmn and move down one row. I have tried placing the appropriate SKIP command in the LostFocus method but haven't gotten the results I want. I have also tried setting the proper row and column using the ACTIVATECELL function.
>>>
>>>Any help would be appreciated
>>
>>Hi Randy,
>>
>>I created a simple test case for this and in the Column TextBox LostFocus event I placed the following code which seems to do what you want:
>>
>>NODEFAULT
>>SKIP 1
>>WITH THIS.PARENT.PARENT
>> .ACTIVATECELL( RECNO(), 3 )
>> .REFRESH
>>ENDWITH
>>
>>You might need to play with the parameters some to get it to function exactly the way you want, especially the RECNO() reference, since the records may not be in RECNO() order. Hopefully this will help you find your solution.
>>
>>Bill
>
>Hi Bill,
>
>I haven't had a chance to try your example, but I came up with this (not so elegant, but it works) solution in the KeyPress method
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>* Cursor movement code. Moves the cursor up or down in same column
>LOCAL lnrecs, lcalias, lnRecno, lnRowNo
>
>IF nKeyCode = 13 && ENTER
>
> CLEAR TYPEAHEAD
>
> lcalias = ALIAS()
> lnrecs = RECCOUNT(lcAlias)
> lnRecno = RECNO(lcAlias)
>
>* Move the cursor to the next or previous record.
> IF lnrecs > 1
> IF lnRecno = lnrecs
> KEYBOARD '{UPARROW}'
> ELSE
> KEYBOARD '{DNARROW}'
> ENDIF
> ENDIF
> NODEFAULT
>ENDIF nKeyCode = '{ENTER}'
>
>I thank you and will give your code a try.
>
>Thanks again,
Randy,
Just keep in mind to use this code in that particular grid.textbox. This code depends on (set order to 0) no order. Also instead of alias() use this.Parent.Parent.RecordSource to prevent some headaches.
Cetin