Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Enter Key Move Down Vertical Data Entry

Status
Not open for further replies.
Sep 17, 2001
673
US
I recall someone telling me of one property change on a grid will make it so pressing enter in a text box in a grid moves down one record rather than to the next field on the same line. Does anyone recall what this setting is?

Regards,

Rob
 
I think you're thinking of AllowAddNew, but it doesn't give exactly what you're asking for. It tells the grid that downarrow out of the last item should add a new record.

Tamar
 
Hi Rob.

Use this textbox class in your grid:

Code:
**************************************************
*-- 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
**************************************************

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top