L
lxl1227
Unregistered / Unconfirmed
GUEST, unregistred user!
一个窗体上左边是rzgroup控件(用的是raize3.0套件,实现类似outlook侧边栏多页功能控件),右边是一个panel容器,想实现如下功能:点击左边每页的图标,右边panel即动态加载相应的frame,并将frame上的控件初始化,每个frame上有一个关闭按钮。源代码如下(有三个frame):
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzGroupBar, ExtCtrls, RzPanel;
type
TForm1 = class(TForm)
RzPanel1: TRzPanel;
RzGroupBar1: TRzGroupBar;
RzGroup1: TRzGroup;
RzGroup2: TRzGroup;
RzPanel2: TRzPanel;
procedure RzGroup1Items0Click(Sender: TObject);
procedure RzGroup1Items1Click(Sender: TObject);
procedure RzGroup2Items0Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2,Unit3,Unit4;
{$R *.dfm}
procedure TForm1.RzGroup1Items0Click(Sender: TObject);
var
a:Tframe2;
begin
a:=Tframe2.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
procedure TForm1.RzGroup1Items1Click(Sender: TObject);
var
a:Tframe3;
begin
a:=Tframe3.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
procedure TForm1.RzGroup2Items0Click(Sender: TObject);
var
a:Tframe4;
begin
a:=Tframe4.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
end.
问题1:如何实现可以某个页面的多次选择,(即选择其它frame时,立即释放当前frame)我用了如下代码,报错
var
a:tframe2
begin
if a<>nil then freeandnil(a)
else
a:=tframe2.create(self);
.......
问题2:每个frame上面的关闭按钮如何实现frame的关闭??
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzGroupBar, ExtCtrls, RzPanel;
type
TForm1 = class(TForm)
RzPanel1: TRzPanel;
RzGroupBar1: TRzGroupBar;
RzGroup1: TRzGroup;
RzGroup2: TRzGroup;
RzPanel2: TRzPanel;
procedure RzGroup1Items0Click(Sender: TObject);
procedure RzGroup1Items1Click(Sender: TObject);
procedure RzGroup2Items0Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2,Unit3,Unit4;
{$R *.dfm}
procedure TForm1.RzGroup1Items0Click(Sender: TObject);
var
a:Tframe2;
begin
a:=Tframe2.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
procedure TForm1.RzGroup1Items1Click(Sender: TObject);
var
a:Tframe3;
begin
a:=Tframe3.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
procedure TForm1.RzGroup2Items0Click(Sender: TObject);
var
a:Tframe4;
begin
a:=Tframe4.Create(Self);
a.Parent:=RzPanel2;
a.Top:=1;
a.Left:=1;
a.Align:=alClient;
a.edt1.Text:='';
a.edt2.Text:='';
end;
end.
问题1:如何实现可以某个页面的多次选择,(即选择其它frame时,立即释放当前frame)我用了如下代码,报错
var
a:tframe2
begin
if a<>nil then freeandnil(a)
else
a:=tframe2.create(self);
.......
问题2:每个frame上面的关闭按钮如何实现frame的关闭??