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

Event code - using the Debugger

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB

I have a grid with a recordSource tDetail. This is used for entering the lines of an invoice.
The user can navigate up and down using the cursor keys; Grdmain.AllowAddNew is set to .T. so new records are added to detail as lines are entered.

The user may also insert new lines in the middle of the invoice (perhaps to add an extra line of description). To handle that keys F11 and F12 are programmed in grdmain.column1.text1.Keypress() &c.

If more lines are entered than will fit into the 8 or so rows of the grid, the grid scrolls up or down – this is a standard feature. I find that sometimes this automatic scrolling of the grid leaves too many blank lines at the bottom of the grid, losing the lines at the top which the user might like to see.

To cope with this, code is included in grdMain.AfterRowColChange() to do various tests and, if necessary, to make call(s) to grdmain.DoScroll()

I make lots of mistakes, and while debugging, put a SET STEP instruction into AfterRowColChange().

Code:
LPARAMETERS nColIndex
LOCAL lCurLine, lWhatLine, lAnswer
WITH Thisform
   SELECT tDetail
   lAnswer = ALIAS()
   lRecno = tDetail.tRecno
   SET STEP ON
   COUNT FOR !DELETED() TO lCount
   IF lRecno = lCount
   . . . . .
   . . . . .

Was rather surprised to see that when the SET STEP instruction has been executed, in the trace window lAnswer shows the value “tDetail” - which I expected - but (also in the trace window), ALIAS() shows the value “Cus” – the customer table, which was the last table to be accessed before the grid was fired up. I would have thought that ALIAS() would also show tDetail.

Can anyone explain why this happens ?

Thanks. Andrew
 
I find that there are times when the Debugger doesn't keep up and I have to click on something in the Watch window to get it to show the latest value. I've never figured out exactly why or when that happens.

Tamar
 
Thanks Tamar.

I had been thinking that it might be something wrong with the installation of VFP on my machine, so it is a relief to find that other users have experienced this !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top