你可以多加一个lable(visible = false),然后: procedure TForm1.Formshow(Sender: TObject); begin label.caption := '正在查询!请稍后'; label.visible := true; form1.update; with adoquery1 do begin close; sql.clear; sql.add('select * from table1 left join table2 table1.yName=table2.yName where table2.yName=Null'); open; label.visible := false; end; end;
procedure TForm1.Formshow(Sender: TObject); begin showmessage('正在查询!请稍后');//程序到这里会停住!不行的! with adoquery1 do begin close; sql.clear; sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null'); open; end; end; 显示不出来???????为什么?要不要创建线程、怎样创建?????????
procedure TForm1.Formshow(Sender: TObject); begin //showmessage('正在查询!请稍后');//显示不出来???????为什么? 楼上说的对,最好不要SHOWMESSAGE 用LABEL或者PANEL最好了 中间加上APPLICATION.PROCESSMESSAGE; 我这么做过,没有问题的 with adoquery1 do begin close; sql.clear; sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null'); open; end; end;
这里怎么能用showmessage呢,即使显示出来了,你不按OK,他也没有开始执行后面的查询呀,还是专门作一个启动过渡窗口,如: procedure DoTip(AifShow: Boolean; AStr: string); begin if frmTip = nil then frmTip := TfrmTip.Create(Application); if trim(Astr)<>'' then frmTip.Label1.caption := AStr; if AifShow then frmTip.Show else frmTip.Close; application.ProcessMessages; end;
APPLICATION.PROCESSMESSAGE;是作什么用的?
象oracle_lover(数据库情人) 的做法,我试过的。 form2中的字句竟然显示不出来,白白的一片! 如下: tform1.form1show(sender:tobject); begin application.createform(tform2,form2); form2.label1.caption:='正在查询,请稍候...'; form2.show; with adoquery1 do begin close; sql.clear; sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null'); open; end; form2.free; end;
仍然要用到APPLICATION.PROCESSMESSAGE
procedure TForm1.Formshow(Sender: TObject);
begin
label.caption := '正在查询!请稍后';
label.visible := true;
form1.update;
with adoquery1 do
begin
close;
sql.clear;
sql.add('select * from table1 left join table2 table1.yName=table2.yName where table2.yName=Null');
open;
label.visible := false;
end;
end;
begin
showmessage('正在查询!请稍后');//程序到这里会停住!不行的!
with adoquery1 do
begin
close;
sql.clear;
sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null');
open;
end;
end;
显示不出来???????为什么?要不要创建线程、怎样创建?????????
begin
//showmessage('正在查询!请稍后');//显示不出来???????为什么?
楼上说的对,最好不要SHOWMESSAGE
用LABEL或者PANEL最好了
中间加上APPLICATION.PROCESSMESSAGE;
我这么做过,没有问题的
with adoquery1 do
begin
close;
sql.clear;
sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null');
open;
end;
end;
Form2.showmodal; //显示提示信息
查询开始...
...
查询结束...
Form2.close; //关闭提示信息
end;
procedure DoTip(AifShow: Boolean; AStr: string);
begin
if frmTip = nil then
frmTip := TfrmTip.Create(Application);
if trim(Astr)<>'' then
frmTip.Label1.caption := AStr;
if AifShow then frmTip.Show
else frmTip.Close;
application.ProcessMessages;
end;
form2中的字句竟然显示不出来,白白的一片!
如下:
tform1.form1show(sender:tobject);
begin
application.createform(tform2,form2);
form2.label1.caption:='正在查询,请稍候...';
form2.show;
with adoquery1 do
begin
close;
sql.clear;
sql.add('select * from table1 left join table2 on table1.yName=table2.yName where table2.yName=Null');
open;
end;
form2.free;
end;
2. 将form2的visible设为false,在创建主Form之前创建它,不要在主Form的事件中创建它
3. form2.showmodal 比 form2.show更符合要求我一直用这种方法,没有出现过问题