I have the following code in the keypress of a textbox in a grid. The textbox is the last control in the grid row. When the user presses enter or tab in the control I move to the first control in the next row of the grid unless I have reached the last row in the grid where I then move to the next control outside the grid. This all works fine. However, I want to be able to determine if the user is leaving the control simply because the end of the control was reached (typed the maximum # of characters in the textbox) if set confirm is off. Any ideas? I imagine that should be trapped for in the lostfocus?
TIA!
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nShiftAltCtrl = 0
IF nKeyCode = 13 .OR. nKeyCode = 9
NODEFAULT
PRIVATE lcalias
lcalias=THISFORM.grid1.RECORDSOURCE
SELECT (lcalias)
PRIVATE thisno, totno
thisno=RECNO(lcalias)
totno = RECCOUNT(lcalias)
IF thisno < totno
SKIP
WITH THISFORM.grid1
lnMaxRows = INT( ( .HEIGHT - .HEADERHEIGHT - ;
IIF( INLIST( .SCROLLBARS, 1, 3 ),;
SYSMETRIC( 8 ), 0 ) ) / .ROWHEIGHT )
IF .RELATIVEROW >= lnMaxRows
.DOSCROLL( 1 )
ENDIF
.ACTIVATECELL( .RELATIVEROW + 1, .ACTIVECOLUMN )
ENDWITH
THISFORM.grid1.column1.check1.SETFOCUS
ELSE
THISFORM.grid2.column1.check1.setfocus
ENDIF
ELSE
RETURN
ENDIF
ELSE
RETURN
ENDIF
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"