**************************************************
*-- Class: txtgrdnextrow
*-- ParentClass: textbox
*-- BaseClass: textbox
*-- Moves to same column in next row when enter is pressed
*
DEFINE CLASS txtgrdnextrow AS txtgrid
BORDERSTYLE = 0
HEIGHT = 18
MARGIN = 0
SELECTONENTRY = .F.
SPECIALEFFECT = 1
WIDTH = 100
*-- Move to the same column in the next row of the grid
PROCEDURE move2nextrow
LOCAL lnMaxRows
WITH THIS.PARENT.PARENT
*** Calculate the maximum number of rows in the grid
lnMaxRows = INT( ( .HEIGHT - .HEADERHEIGHT - IIF( INLIST( .SCROLLBARS, 1, 3 ), SYSMETRIC( 8 ), 0 ) ) / .ROWHEIGHT )
*** If we are sitting on the bottom row in the visible portion of the grid,
*** Scroll the grid down a row in case there is a next record
IF .RELATIVEROW >= lnMaxRows
.DOSCROLL( 1 )
ENDIF
.ACTIVATECELL( .RELATIVEROW + 1, .ACTIVECOLUMN )
ENDWITH
ENDPROC
PROCEDURE KEYPRESS
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 13
THIS.move2nextrow()
NODEFAULT
ENDIF
ENDPROC
ENDDEFINE
*
*-- EndDefine: txtgrdnextrow
**************************************************