if not IsWindowExists('frm_spbm') then
Application.CreateForm(Tfrm_spbm,frm_spbm);
frm_spbm.show;
function IsWindowExists(form_1:string):boolean ;
var com_count,i:integer;
begin
com_count:=strtoint((inttostr(Application.ComponentCount)))-1;
for i:=0 to com_count do
begin
if Application.Components[i].Name=form_1 then
break;
end;
if i > com_count then
result:=false
else
result:=true;
end;这样不行
if not assigned(frm_spbm) then
Application.CreateForm(Tfrm_spbm,frm_spbm);
frm_spbm.show;
这样也不行,还是重复创建了,怎么回事
Application.CreateForm(Tfrm_spbm,frm_spbm);
frm_spbm.show;
function IsWindowExists(form_1:string):boolean ;
var com_count,i:integer;
begin
com_count:=strtoint((inttostr(Application.ComponentCount)))-1;
for i:=0 to com_count do
begin
if Application.Components[i].Name=form_1 then
break;
end;
if i > com_count then
result:=false
else
result:=true;
end;这样不行
if not assigned(frm_spbm) then
Application.CreateForm(Tfrm_spbm,frm_spbm);
frm_spbm.show;
这样也不行,还是重复创建了,怎么回事
在OnClose中,将Action 设为 caFree,同时将frm_spbm 设为 nil应该可以了吧。
然后就可以用if Assinged(frm_spbm)进行判断了。
if not assigned(frm_spbm) then
frm_spbm := Tfrm_spbm.Create(Self);
frm_spbm.Show;