Good info, thanks, will try it when in front of computer.
PS. The complete start of the code I have in my program is like this:
procedure TDocument.srDocStateChange(Sender: TObject);
begin
if OnlyReadAllowed then
begin
if (tbDoc.State in [dsInsert, dsEdit]) then // ERROR?
begin
tbDoc.Cancel;
if tbDoc.Transaction.InTransaction then
tbDoc.Transaction.RollbackRetaining;
end;
end;
//... some extra code for enabling save buttons etc.
This will prevent any component from switching the Datasource to dsEdit or dsInsert.
And works perfectly with all TDBEdits and TDBGrids.
This solution kind of solved the problem in Linux Mint, it didn't crash, but raised another problem.
Cancel method seem didn't halt the application. After Cancel issued, execution of next codes continued and here is the problem. Sometimes, there is some condition must be meet before able to successfully execute next code.
For example, there are 3 Fields, Field A, B & C.
Field C will calculate Field B/Field A. If there is Cancel method issued on Field A, since execution will still continue, error will be raised.
This is different with Abort method. When Abort issued, code to calculate Field C won't be execute.
Of course, another checking codes could be added to check for certain condition, but because there are lots of events that will be affected by OnStageChange, application complexity grows.