Thema: Delphi Second Form and Thread

Einzelnen Beitrag anzeigen

christian_r
(Gast)

n/a Beiträge
 
#3

Re: Second Form and Thread

  Alt 5. Mai 2008, 04:02
Good morning.

A modal form has not to be closed with "TForm.Close".

Zitat von Delphi Help:
To close a modal form, set its ModalResult property to a nonzero value.
As next here is the example of the same help topic. It explains, how to close the modal form in the right way.

Delphi-Quellcode:
procedure TMyDialogBox.OKButtonClick(Sender: TObject);

begin
  ModalResult := mrOK; // mrOK ...
end;

procedure TMyDialogBox.CancelButtonClick(Sender: TObject);
begin
  ModalResult := mrCancel; // ... and mrCancel are nonzero values
end;

// This code brings up the modal dialog from Form1 when a button is clicked. It causes a Beep if the OK button is clicked.

procedure TForm1.Button1Click(Sender: TObject);

begin
  if MyDialogBox1.ShowModal = mrOK then
    Beep;
end;
So you don't need to thread this modal form for that simple problem.
  Mit Zitat antworten Zitat