procedure TEditorForm.FileMenuExitClick(Sender: TObject);
var
userResponse: Integer;
tempString: String;
begin
if not(Editor.Modified) then
begin
WriteINIFile;
EditorForm.Close;
end
else
begin
if (currFileName = untitledName) then tempString := 'Save changes to unnamed file?'
else tempString := 'Save changes to ' + shortFileName + ' ?';
userResponse := MessageDlg(tempString, mtConfirmation, mbYesNoCancel, 0);
case userResponse of
idYes: FileMenuSaveClick(Self);
idNo:
begin
Editor.Modified := False;
EditorForm.Close;
end;
{if the response is Cancel nothing will happen...}
idCancel: ;
end;
end;
end;
OR, for a dlg box with just yes and no in, use:
userResponse := MessageDlg(tempString, mtConfirmation, [mbYes, mbNo], 0);