他们的实例不能同时创建,而且还要动态的创建 botton1.event begin if gwFrame1<>nil then gwFrame1:=frame1.creat(....) end;botton2.event begin if gwFrame1<>nil then gwFrame1:=frame2.creat(....) end; 明白了吗?
///////sorry,写写错了 botton1.event begin if gwFrame1<>nil then gwFrame1。free else gwFrame1:=frame1.creat(....) end;botton2.event begin if gwFrame1<>nil then gwFrame1。free else gwFrame1:=frame2.creat(....) end;
botton1.event
begin
if gwFrame1<>nil then
gwFrame1:=frame1.creat(....)
end;botton2.event
begin
if gwFrame1<>nil then
gwFrame1:=frame2.creat(....)
end;
明白了吗?
botton1.event
begin
if gwFrame1<>nil then
gwFrame1。free
else
gwFrame1:=frame1.creat(....)
end;botton2.event
begin
if gwFrame1<>nil then
gwFrame1。free
else
gwFrame1:=frame2.creat(....)
end;
>> 请高手指导你的这个问题在你的代码角度上看基本是不可能的,因为有frame1就没有frame2,所以除非你的类属性是static,要不然在没有实例的情况下是不可能的任务,当然,如果你只是把frame变的不可见,而不是把它们free的话,就可以了。
DELPHI中有这个关键字么