Hi there!
On my onCloseQuery events I check MyQuery1.modified and show the user and dialog box that asks for saving, if he made changes on this form.
My Problem:
If I make changes in EditField1, and then goto EditField2, MyQuery1.modified is true.
But if I make changes only in EditField1 and don't leave the EditField1 , MyQuery1.modified is false altough the data in EditField1 was altered.
Is there a way to solve this?
Thank you very much,
greets ben
Question for query.modified
A new field value is not passed to dataset until you edit the value in TDBEdit. When you exit from TDBEdit, it passes the new value to the underlying dataset, and the dataset becomes modified. So this is a designed behaviour of standard VCL classes. You can do something like this:
Code: Select all
if MyQuery.Modified then
Modified := True
else
if Form1.ActiveControl is TDBEdit then
Modified := TDBEdit(Form1.ActiveControl).Modified;