Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid issue... SKIPping and ActivateCell
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00957884
Message ID:
00957896
Views:
23
This message has been marked as the solution to the initial question of the thread.
>I have an intermittant problem w/ a grid. The requirement is that if the user is on the last row of a grid (natural order only) and the user enters a value into a field (column 2) in that last row, code fires to append a blank row to the bottom and then return to the row the user was on before the append, so they can continue w/ data entry. That works fine. The issue is with the last column in the grid. The idea is to move the record pointer to the newly added last row (the blank record) as the user tabs thru the last column of the last row.
>
>This works correctly some of the time. It works all of the time if i trace the code. But i cannot identify a pattern as to when it works and doesnt. Other than its not a problem for the first 8 or 9 records that get added. After that, its intermittant. The code is shown below. There are no deleted records involved. Anything look out of place?
>
>
>IF MESSAGEBOX("Do u wanna set step on?") = 6
>   SET STEP ON
>ENDIF
>SELECT temploc
>IF ! EOF()
>   nRec = RECNO() + 1
>   SKIP
>   IF EOF()
>      SKIP -1
>      nRec = nRec - 1
>   ENDIF
>   thisform.LockScreen = .t.
>   thisform.grdlocs.ActivateCell(nRec,1)
>   thisform.grdlocs.column1.SetFocus()	
>   thisform.grdlocs.Refresh()
>   thisform.LockScreen = .f.
>ENDIF
>
Chris,

Keeping your objective of moving the focus to the next row when tabbed out of the last column in mind, the following code works great:
(In the KeyPress event of the text box of the last column)
LPARAMETERS nKeyCode, nShiftAltCtrl
IF m.nKeyCode=9 ;
THEN 
	KEYBOARD '{DNARROW}' PLAIN CLEAR 
ENDIF 
This will move the focus to the first column of the next row when you tab out the last column. Then you don't have to worry about record number at all.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform