AndrewMozley
Programmer
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