在模式窗体中弹出一对话框,关闭对话框时模式窗体也随着关闭了,这是怎么回事啊啊。主要代码如下:
function TfrmChose.checkdata:Boolean;
begin
Result:=False;
if cbClass.Text ='' then
begin
Application.MessageBox('班级不能为空,请选择班级!','缺少内容',MB_OK +
MB_ICONINFORMATION);
cbClass.SetFocus;
Exit;
end;
Result:=True;
end;procedure TfrmChose.btnOKClick(Sender: TObject);
begin
if checkdata then
begin
……
end;
end;
function TfrmChose.checkdata:Boolean;
begin
Result:=False;
if cbClass.Text ='' then
begin
Application.MessageBox('班级不能为空,请选择班级!','缺少内容',MB_OK +
MB_ICONINFORMATION);
cbClass.SetFocus;
Exit;
end;
Result:=True;
end;procedure TfrmChose.btnOKClick(Sender: TObject);
begin
if checkdata then
begin
……
end;
end;
IsClose:Boolean;
.....
function TfrmChose.checkdata:Boolean;
begin
Result:=False;
if cbClass.Text ='' then
begin
IsClose:=false;//不关闭
Application.MessageBox('班级不能为空,请选择班级!','缺少内容',MB_OK +
MB_ICONINFORMATION);
cbClass.SetFocus;
Exit;
end;
Result:=True;
IsClose:=true;//关闭
end;在FrmChose.OnCloseQuery中
canClose:=IsClose;