Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displacement within a grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01673499
Message ID:
01673506
Views:
93
>How can I do so that within a grid I can scroll down instead of horizontally? When updating a data in a column the cursor jumps to the next column and not to the next line. I need a practical example

For one grid I have, I only do that action if the user is on the last column of the grid - and I only do it if they press Tab or hit Enter. Here is the code. There might be better code out there but this works. It goes in the keypress event of the textbox control that is in the column (at least it is a textbox control in my grid):
* KeyPress()
* Written by: Albert Gostick
* Last Updated: Jun 19, 2008

* Changes:
* Jun 19, 2008: changed code to accommodate fact that first column now contains a picklist; also had to change how we moved
*   down a row as was just not working with keyboarding a DNArrow
* May 29, 2000: original coding

* augment the code so that if the user presses <Enter> or <Tab> on this last cell that it goes to the beginning of the next line

LPARAMETERS nKeyCode, nShiftAltCtrl

* if user pressed <Enter> or <Tab> go to the next row down
IF nShiftAltCtrl = 0 AND ( nKeyCode = 13 OR nKeyCode = 9 )

   * lockscreen does not seem to do anything here so stripped out

   * this code used to KEYBOARD a DNARROW to get to the next row but could not get this working once we added a combolist
   * to the first col (which interprets a Down arrow differently); so thought about it and probably what I should be
   * doing is moving the record pointer and then refreshing the screen {June 19/08}

   * reference back to the grid
   WITH THIS.Parent.Parent

   * get over the record source (should be already but be safe)
   SELECT (.RecordSource)

   * only thing that could mess us up is an EOF() condition
   IF NOT EOF()
      SKIP
   ENDIF

   * refresh the grid to display the new record
   .Refresh()

   * and then set the focus to the first Col; note that KEYBOARD "{DNARROW}" PLAIN used to be here
   * KEYBOARD "{DNARROW}" PLAIN

   .Column1.SetFocus()

   ENDWITH  && for THIS.Parent.Parent

ENDIF

* do the default code
DODEFAULT(nKeyCode, nShiftAltCtrl)

RETURN
Previous
Reply
Map
View

Click here to load this message in the networking platform