Harvey,
Copy the original file to a new file may be better. When they exit the dialog it can erase the new file and recopy the existing file in its place.
So the activity only occurs when the undo button is pressed....interesting. Grab the data from the new file place into the get of the original...
OK, it sounds like you are not using an editing buffer but rather you are editing the fields of the record directly. If so, then when a user edits a field, then exits it, the data is automatically written to the disk. In this case the only way you could have a Cancel button on the dialog is to already have stored the original data before presenting the dialog.
The better way is to copy all the fields into a buffer array and then use this buffer to edit in the dialog. Then the Cancel button just closes the dialog with no further action. The OK button would save the buffer to the disk.
I would not call either of the above an "undo" but rather just a cancel. If the user made changes then decided to not save them, they just press the Cancel button. They can then reload the original data by opening the dialog again.
Conversly, the Undo I was describing in my previous message would enable a user to undo the last changes made to a record at any time until another edit and save was made to that record--this could be a minute, day, week, month later.
Forgive me if you already know this, but this an important point regarding user interface design. All modal dialogs should have two terminating buttons, OK and Cancel. OK saves and closes the dialog, and Cancel just closes the dialog. This is why you really must use a buffer to edit data.
Perhaps this answers your original question--maybe you just didn't have a Cancel?
You can't really put an Undo button on an edit dialog, because it would unclear as to what it does. If you opened the dialog then immediately pressed Undo, you would get the previous data (before the last edit and save). But if you edited the data, then pressed Undo, you would still get the previous data, not the current data in the record before the edit. Very confusing.
Perhaps you can clarify whether you wanted a Cancel or an Undo?
Regards,
James