Latest versions of FP and Lazarus.
How do I stop windows from requesting a file name?
I am sending a full path and a file name with an extension.
procedure TForm4.Button2Click(Sender: TObject); //Save form
Var sr:srpt; // shift record
f:file of srpt;
fname:String;
begin // savedialog only saves the memo field
// save edit fields into shfname1 EDT.
saveDialog1.Filename:=ExtractFilepath(ParamStr(0))+ShFname;
ShowMessage(saveDialog1.FileName); //c:\lazprj\sql3\createdb\shftrpt.dat
if SaveDialog1.Execute then
Memo1.Lines.SaveToFile(SaveDialog1.FileName) //shows c:\lazprj\sql3\createdb\shftrpt
else Showmessage('Memo not saved'); // without the extension.
// now we need to save the edit fields
fillchar(sr,sizeof(Sr),0);
sr.Store:=Edit1.text;
sr.date:=Edit2.text;
sr.Shift:=Edit3.Text;
Fname:=ExtractFilepath(ParamStr(0))+Shfname1; // shfname1 is shftrpt.edt
ShowMessage(fname);
Assignfile(f,fname) ; // Assign(f,fname) pulls up Tpersistent
{$I+} rewrite(f); {$i-} // Why?
if ioresult=0 then
Write(f,sr);
ShowMessage(fname+' written.');
Closefile(f);
end;