Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entering data into grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Entering data into grid
Miscellaneous
Thread ID:
00735860
Message ID:
00735860
Views:
38
Does anyone know the best way to make the cursor move to the next line in a grid when the enter key is pressed on the last field (amount) and the value has cents. Anotherwards, the default action never fires the valid where the test for the keypress is. If I put code in the keypress event it makes the grid behave weird. This is the code in the valid:
* Method.:txtamt.valid
* Modified 12/26/2002 by CWILLIAMS

* calculate the total of all non-deleted records
* and calulate the total number of records to display
* a running total of each for all input
* 13=enter key
* 24=downarrow
LOCAL nKey
nKey = LASTKEY()
LOCAL lnTmpTotal,lnToCnt
lnTemp=RECNO()
COUNT FOR !DELETED() TO lnTotCnt
lnTmpTotal=0
GO TOP
DO WHILE NOT EOF()
	IF !DELETED() then
		lnTmpTotal=lnTmpTotal+amt
	ENDIF
	SKIP
ENDDO

GOTO lnTemp
WITH ThisForm
     .txtEnterTotal.VALUE=lnTmpTotal
     .txtTotRecCnt.VALUE=lnTotCnt
ENDWITH
* add new record if downarrow or enter key pressed
IF nKey= 13 OR nKey= 24
	KEYBOARD '{DNARROW}'
	IF EOF()
		GO BOTTOM
		APPEND BLANK
	ENDIF
ENDIF
THIS.REFRESH
Extreme Programming = Plan -> Design -> Code -> Test
Next
Reply
Map
View

Click here to load this message in the networking platform