function Execute: Boolean;
var
From1: TForm1;
begin
Form1 := TForm1.Create(Application);
if Form1.ShowModal = mrOK then
Result := True
else
Result := False;
end;
var
From1: TForm1;
begin
Form1 := TForm1.Create(Application);
if Form1.ShowModal = mrOK then
Result := True
else
Result := False;
end;
用Form的ModalResult不就可以了。
var
form3:Tform2;
begin
Form3:=Tform2.Create(Application);
if form3.ShowModal=mrok then
result:=1
else
result:=2;
end;
这样做的话,原来Form2 的按钮变得不起作用了??
procedure TMyDialogBox.OKButtonClick(Sender: TObject);begin
ModalResult := mrOK;
end;procedure TMyDialogBox.CancelButtonClick(Sender: TObject);
begin
ModalResult := mrCancel;end;//在Form1中showModal 出 MyDialogBox1
procedure TForm1.Button1Click(Sender: TObject);begin
if MyDialogBox1.ShowModal = mrOK then
Beep;end;具体你可以看一下ModalResult 的帮助。