I have a dialog with some fields in it. The user is suppose to fix the form which will later on be parsed. When the user presses ok, the data goes to the database if the checks are successful, if not a warning should be shown and the data dialog should stay. Something like shown below:
procedure TDataSaver.OKBtnClick(Sender: TObject);
begin
if checkData then
saveDataInDatabase
else
…prevent from closing code…
end;
Use OKBtn.ModalResult := mrNone as default value and
procedure TDataSaver.OKBtnClick(Sender: TObject);
begin
if checkData then
ModalResult := mrOK;
end;
I'd recommend building your own dialog box. It is trivially easy and once you start, you can get exactly what you want and add to it later easily if needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With