you forgot 'fmprogress' before 'Close'?
procedure TfmCleanUpMain.btnOKClick(Sender: TObject); begin if fmprogress.showmodal <> mrNone then FMPROGRESS.close; end; Also in 'procedure TfmProgress.FormActivate' you should not use fmProgress.ModalResult := mrOK; but Self.ModalResult := mrOK; John Barrat wrote: > Can someone explain what I am doing wrong? > > I have a form which is there simply to report progress - it has a > progressbar on it. > This is how I am calling it: > > procedure TfmCleanUpMain.btnOKClick(Sender: TObject); > begin > if fmprogress.showmodal <> mrNone then > close; > end; > > On its return I close the application. > > I do all the work on the progress form in the OnActivate event. - this may > be my problem but I don't know a way around it as there is no user > interaction with the form. > > My FormActivate code is shown below. Although I set the modal result to > mrOK the form fails to close. > > procedure TfmProgress.FormActivate(Sender: TObject); > Var i: Integer; > begin > FindFilesToDelete; > ProgressBar1.Max := FileList.Count; > ProgressBar1.Min := 0; > ProgressBar1.Position := ProgressBar1.Max; > For i := 0 to FileList.Count -1 do > begin > Label1.Caption := '"'+ ExtractRelativePath(IDEPath,FileList[i]) + '"'; > if DeleteFile(FileList[i])then > ProgressBar1.Position := ProgressBar1.Position - 1; > end; > Label1.Caption := 'Done'; > fmProgress.ModalResult := mrOK; > end; > > Can anyone suggest a solution? > > JohnB > > > > > > > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

