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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to arrange cursor-direction on enter in a grid?

Status
Not open for further replies.

INFORMAT

Programmer
Jan 3, 2001
121
BE
I use a grid just like Excel to enter some values in a column. On enter, I want the cursor to go to the next cell in that column, but one row lower (= moving down in the column). When I'm on the last row in the column, on enter the cursor must stay in the cell.

My grid already works OK, but I always has to use the down-arrow-key to go to the next cell... I like to make it better so that on enter the cursor automatic goes to the lower cell...

How can you do this in Visual Foxpro 6.0? Thanks for your help...
 
In the KeyPress Event of your TextBoxes you'd could add the following code:

LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 13 && Enter
KEYBOARD "{DNARROW}" PLAIN
NODEFAULT
RETURN
ENDIF
DODEFAULT(nKeyCode, nShiftAltCtrl)

Note: To handle your "last row" scenario, you'll need to add some code based on some other known information.

Rick
 
Actually, I think the code rgbean provided will do just what you're looking for. Basically, the code intercepts an ENTER keypress and changes it to a DOWN keypress. If it is on the last row, pressing DOWN won't go anywhere, so it will be fine.

Another possibility would be to use the following command:

ON KEY LABEL ENTER keyboard "{DNARROW}"

This will cause FoxPro to treat ALL enter keypresses as if you had hit the DOWN arrow. Issue "ON KEY" to restore your the ENTER key to its previous functionality.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top