L
leoxi82
Unregistered / Unconfirmed
GUEST, unregistred user!
请问,动态创建frame后该如何释放!
我在其中一个frame上的按扭动态创建另外一个frame,多次调用后就会报错,
我释放用的是freeandnil(),请高手快来帮忙哦!
LockWindowUpdate(Handle);
Perform(wm_free,0,0);
try
case ftype of
0:begin
ToolBar:=TfamReserveToolBar.Create(self);
Panel:=TFamReserve.Create(self);
end;
1:begin
ToolBar:=TfamEnterToolBar.Create(self);
Panel:=TfamEnter.Create(self);
end;
2:begin
ToolBar:=TFamOrderToolBar.Create(self);
Panel:=TfamOrder.Create(SELF);
end;
3:begin
ToolBar:=TfamPayToolBar.Create(self);
Panel:=TfamPay.Create(SELF);
end;
4:begin
ToolBar:=TFamPostToolBar.Create(self);
Panel:=TfamPost.Create(SELF);
end;
5:begin
ToolBar:=TFamMemberToolBar.Create(self);
Panel:=TFamAddMember.Create(self);
end;
6:begin
ToolBar:=TfamPeopleToolBar.Create(self);
Panel:=TfamPeople.Create(self);
end;
7:begin
ToolBar:=TfamRightToolBar.Create(self);
Panel:=TfamRight.Create(self);
end;
8:begin
ToolBar:=TfamNextToolBar.Create(self);
Panel:=TfamHandToNext.Create(self);
end;
9:begin
ToolBar:=TfamOverToolBar.Create(self);
Panel:=TfamOver.Create(self);
end;
end;
w:=w+1;
g:=g+1;
ToolBar.Parent:=Panel1;
Panel.Parent:=Panel2;
ToolBar.Name:='Tool'+IntToStr(w);
Panel.Name:='Pan'+IntToStr(g);
except
Perform(wm_free,0,0)
end;
LockWindowUpdate(0)
我在其中一个frame上的按扭动态创建另外一个frame,多次调用后就会报错,
我释放用的是freeandnil(),请高手快来帮忙哦!
LockWindowUpdate(Handle);
Perform(wm_free,0,0);
try
case ftype of
0:begin
ToolBar:=TfamReserveToolBar.Create(self);
Panel:=TFamReserve.Create(self);
end;
1:begin
ToolBar:=TfamEnterToolBar.Create(self);
Panel:=TfamEnter.Create(self);
end;
2:begin
ToolBar:=TFamOrderToolBar.Create(self);
Panel:=TfamOrder.Create(SELF);
end;
3:begin
ToolBar:=TfamPayToolBar.Create(self);
Panel:=TfamPay.Create(SELF);
end;
4:begin
ToolBar:=TFamPostToolBar.Create(self);
Panel:=TfamPost.Create(SELF);
end;
5:begin
ToolBar:=TFamMemberToolBar.Create(self);
Panel:=TFamAddMember.Create(self);
end;
6:begin
ToolBar:=TfamPeopleToolBar.Create(self);
Panel:=TfamPeople.Create(self);
end;
7:begin
ToolBar:=TfamRightToolBar.Create(self);
Panel:=TfamRight.Create(self);
end;
8:begin
ToolBar:=TfamNextToolBar.Create(self);
Panel:=TfamHandToNext.Create(self);
end;
9:begin
ToolBar:=TfamOverToolBar.Create(self);
Panel:=TfamOver.Create(self);
end;
end;
w:=w+1;
g:=g+1;
ToolBar.Parent:=Panel1;
Panel.Parent:=Panel2;
ToolBar.Name:='Tool'+IntToStr(w);
Panel.Name:='Pan'+IntToStr(g);
except
Perform(wm_free,0,0)
end;
LockWindowUpdate(0)