由于我是在线程的FOR循环中操作,出现2种状况,搜寻一整天,还是没答案if Form2.ShowModal=mrok then 后,
①有时会出现 Form2 上控件部分无法显示,例如EDIT\BUTTON②而有时呢,点完Form2的BUTTON后,没反应,窗体没关闭。(注意:BUTTON的已设置为mrok)我也在FORM1中写了个BUTTON事件,Form2.close; 但是却不能够关闭这个异常窗口。不知道是该怎么办。哪怕能够让我关闭掉FORM2也行。
①有时会出现 Form2 上控件部分无法显示,例如EDIT\BUTTON②而有时呢,点完Form2的BUTTON后,没反应,窗体没关闭。(注意:BUTTON的已设置为mrok)我也在FORM1中写了个BUTTON事件,Form2.close; 但是却不能够关闭这个异常窗口。不知道是该怎么办。哪怕能够让我关闭掉FORM2也行。
前后的代码多打几行Form2的onOK和onCancel过程也打出来看看
以下是function
for I := 2 to 4 do
begin
HttpPostM('http://**','&code=&no=' + IntToStr(I), MD);
GetXMLCM(MD, Code, Str);
Msg := Str;
if Code = 0 then Break;
if Code = -310150 then
begin
if Form2.ShowModal=mrok then
begin
Vcode:= QVcode;
HttpPostM('http://**','&code='+Vcode+'&no=' + IntToStr(I), MD);
GetXMLCM(MD, Code, Str);
Msg := Str;
if Code = 0 then Break;
end;
end;
begin
Button1.Enabled:=False;
QVcode:=LabeledEdit1.Text;
Self.ModalResult:=mrOK;
end;procedure TForm2.Button2Click(Sender: TObject);
begin
Close;
end;procedure TForm2.FormShow(Sender: TObject);
begin
Button1.Enabled:=True;
Image1.OnClick(nil);
LabeledEdit1.Clear;
LabeledEdit1.SetFocus;
end;