[Lazarus] Differentiate between insert and append in TDataset events
Luca Olivetti
luca at wetron.es
Wed Jun 29 09:57:17 CEST 2022
Hello,
using a TDbGrid, I want to take different actions if the user is
inserting or appending a record (in this case to automatically assign
the ordering field so that the record appears in the right row after post).
The method TDataSet.DoInsertAppend just differentiates them internally,
there is no flag/parameter to indicate it to the events (i.e.
BeforeInsert, OnNewRecord, AfterInsert), I suppose because delphi does
it that wey.
Now, since I'm using zeos, I see that if it's inserting, the RecNo in
AfterInsert is the same as it was in BeforeInsert, while they are
different during an append.
I suppose that depends on the TDataset and database used, so it may not
hold true if I switch to a different dataset or database.
Is there a better, proper, way to discriminate between the two cases?
Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
More information about the lazarus
mailing list