tags:

views:

129

answers:

2

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;
+6  A: 

Use OKBtn.ModalResult := mrNone as default value and

procedure TDataSaver.OKBtnClick(Sender: TObject);
begin
  if checkData then
    ModalResult := mrOK;
end;
splash
A: 

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.

David