I've just been looking a bit more closely at these keys.
By default, Home and End move the insertion point to the start or end of the
current cell (unless AllowCellSelection is .F., in which case they have no effect).
It's CTRL+HOME and CTRL+END that go to the very top of bottom of the grid.
If I was you, I'd be inclined to leave it that way. After all, it's the native behaviour, and as we mentioned earlier, it's rarely a good idea to override that.
But if you really want to use Home and End to go the very top or bottom, you can trap those keys in the KeyPress event, and then programmatically GO TOP or GO BOTTOM, and then call the grid's SetFocus (to make the change visible). You would normally do all that in the
grid's KeyPress event, but if the grid's AllowCellSelection is .T., you would have to do it for the individual cells.
The codes to trap in the KeyPress are 1 (for Home) and 6 (for End). So your code would look something like this:
Code:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 1
GO TOP
This.SetFocus
ENDIF
IF nKeyCode = 6
GO BOTTOM
This.SetFocus
ENDIF
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads