Hello Adam,
Again an interesting question !
Here is what I would try if I were you :
Assuming you use the same form, and you use "hard coded new record and save" functions (no code on your part, just MVD doing it's job :
1- set edit fields and save button to "disabled"
2- just before the edit activates, enable them
3- just after the save action, disable them again
Disabling AFTER the save action is easy, you just have to use the OnAfterClick property of the save button like :
procedure Form1_SaveButton_OnAfterClick (Sender: string);
begin
Form1.Edit1.Enabled := False;
Form1.Edit2.Enabled := False;
// and so on for as many buttons as you have
Form1.SaveButton.Enabled := False;
end;
Unfortunately, there is no OnBeforeClick property, so clicking on the "New record" button, can not enable the edit fields and button (that you previously had disabled by default).
What you could use is the OnMouseDown property. This will detect if a mouse button is clicked over the corresponding button, which is equivalent to an imaginary OnBeforeClick
procedure Form1_NewRecordButton_OnMouseDown (Sender: string; MouseLeft, MouseRight, MouseMiddle: boolean; Shift, Alt, Ctrl: boolean; X, Y: Integer);
begin
Form1.Edit1.Enabled := True;
Form1.Edit2.Enabled := True;
// and so on for as many buttons as you have
Form1.SaveButton.Enabled := True;
end;
Try it for yourself and let me known if it worked, and don't forget to set your edit fields and save button to disabled by default.
Cheers
Mathias
I'm a very good housekeeper !
Each time I get a divorce, I keep the house
Zaza Gabor