Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Goto next row in grid
Message
 
To
22/01/1999 08:16:27
Shane Gilbert
Oklahoma State Department of Education
Norman, Oklahoma, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00178880
Message ID:
00178919
Views:
20
>I need to automatically go to the next row down in a grid after entering data in the last column. ANy suggestions?
>
>Shane

Try calling following function from last columns KeyPress().


************************************************************
* FUNCTION SkipGridRow()
************************************************************
* Author............: Jayesh Patel
* Project...........: Visual Codebook Framework
* Created...........: 11/27/98
* Copyright.........: (c)1998-9 Avani Cimcon
*) Description.......: Skips Grid row when enter is pressed on the last column.
*) : Sets focus to the first column in the next available row.
*) : In case of EOF, sets focus to an object passed as an optional para.
* Calling Samples...: Generally called from Column.Text.KeyPress()
* : IF nKeyCode = 13
* : =SkipGridRow(GridObject,Grid Alias (Optional),Object (Optional))
* : NODEFAULT
* : ENDIF
* Parameter List....: toGrid = Grid Object
* : tcAlias = Grid Alias (optional)
* : toObject = Object on which focus to be set in case of EOF (optional)
* Major change list.:
FUNCTION SkipGridRow(toGrid,tcAlias,toObject)
*-- RecordSource of Grid is assumed as an Alias if not passed as an argument
tcAlias = IIF(TYPE('tcAlias') = 'L',toGrid.RecordSource,tcAlias)
IF NOT EOF(tcAlias)
*-- Skip the Row
SKIP IN (tcAlias)
IF NOT EOF(tcAlias)
*-- Get Number of rows in display area
IF toGrid.RelativeRow = GetRowsInGrid(toGrid)
*-- Scroll Down to one row if sitting on the last row
toGrid.DoScroll(1)
ENDIF
*-- Activate First Column of Next Row
toGrid.ActivateCell(toGrid.RelativeRow + 1,1)
ENDIF
ENDIF
IF EOF(tcAlias) AND TYPE('toObject') = 'O'
toObject.SetFocus()
ENDIF
ENDFUNC


************************************************************
* FUNCTION GetRowsInGrid()
************************************************************
* Author............: Jayesh Patel
* Project...........: Visual Codebook Framework
* Created...........: 11/27/98
* Copyright.........: (c)1998-9 Avani Cimcon
*) Description.......: Returns
*) : Sets focus to the first column in the next available row.
*) : In case of EOF, sets focus to an object passed as an optional para.
* Calling Samples...: Generally called from Column.Text.KeyPress()
* : IF nKeyCode = 13
* : =SkipGridRow(GridObject,Grid Alias (Optional),Object (Optional))
* Parameter List....: toGrid = Grid Object
* : tcAlias = Grid Alias (optional)
* : toObject = Object on which focus to be set in case of EOF (optional)
* Major change list.:
FUNCTION GetRowsInGrid(toGrid)
LOCAL lnRows
WITH toGrid
lnRows = INT((.Height - IIF(INLIST(.ScrollBars,1,3),SYSMETRIC(14),0) - .HeaderHeight)/.RowHeight)
ENDWITH
RETURN lnRows
ENDFUNC
- Jayesh
Previous
Reply
Map
View

Click here to load this message in the networking platform