Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a strange contortion instead of simply returning FCurRec:
function TFixedFormatDataSet.GetRecNo: Longint; var BufPtr: TRecordBuffer; begin Result := -1; if GetActiveRecBuf(BufPtr) then Result := PRecInfo(BufPtr + FRecInfoOfs)^.RecordNumber; end; Why? Background: if you have, say, 3 records (0,1 and 2), and you insert a new record between 1 and 2, FCurRec of the new record will be 2, while RecordNumber (hence RecNo) will be 3, with this result: RecordNumber (RecNo) | FCurRec -----------------------+---------- 0 | 0 1 | 1 new record-> 3 | 2 2 | 3 I know that RecNo is documented not to be reliable in all cases, but it should be with this dataset, considering that FCurRec has the "correct" value. TDBGrid apparently uses RecNo for the scrollbar, and with the above scenario the scrollbar jumps around while scrolling through the table. OK, that (while bad) is not really my problem, I just want to know if I'm positioned at the first (RecNo=0) or the last (RecNo=RecordCount-1) record (EOF and BOF don't work unless you try to move past the last or first record). Luckily enough FCurRec is protected, so I just subclass TSdfDataset and override the GetRecNo method to return FCurRec, but I'd like to know the reason why it doesn't do it by default. Bye -- Luca _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal