unit Unit1; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters,
dxSkinsdxNavBarPainter, dxSkinscxPCPainter, cxPCdxBarPopupMenu, cxPC,
dxNavBarCollns, cxClasses, dxNavBarBase, dxNavBar, dxSkinsdxStatusBarPainter,
dxStatusBar; type
TForm1 = class(TForm)
dxNavBar1: TdxNavBar;
dxNavBar1Group1: TdxNavBarGroup;
dxNavBar1Group2: TdxNavBarGroup;
dxNavBar1Group3: TdxNavBarGroup;
dxNavBar1Group4: TdxNavBarGroup;
dxNavBar1Item1: TdxNavBarItem;
dxNavBar1Item2: TdxNavBarItem;
dxNavBar1Item3: TdxNavBarItem;
dxNavBar1Item4: TdxNavBarItem;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
dxStatusBar1: TdxStatusBar;
Procedure Addpage(cText:String);
procedure dxNavBar1Item1Click(Sender: TObject);
procedure dxNavBar1Item2Click(Sender: TObject);
procedure dxNavBar1Item3Click(Sender: TObject);
procedure dxNavBar1Item4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm}
Procedure TForm1.Addpage(cText:String);
Var
I:integer;
bNew:Boolean;
TempTab:TcxTabSheet;
begin
bNew:=true;
for I := to Self.cxPageControl1.PageCount- do
begin
if cxpageControl1.Pages[i].Caption=cText then
begin
cxpagecontrol1.Properties.ActivePage:=cxpagecontrol1.Pages[i];
bNew:=False;
end;
end;
IF bNew then
begin
TempTab:=TcxTabSheet.Create(cxpageControl1);
TempTab.Caption:=cText;
TempTab.PageControl:=cxpageControl1;
cxPageControl1.Properties.ActivePage:=TempTab;
end;
end;
procedure TForm1.dxNavBar1Item1Click(Sender: TObject);
begin
Addpage((Sender as TdxNavBarItem).Caption);
end;
procedure TForm1.dxNavBar1Item2Click(Sender: TObject);
begin
Addpage((Sender as TdxNavBarItem).Caption);
end; procedure TForm1.dxNavBar1Item3Click(Sender: TObject);
begin
Addpage((Sender as TdxNavBarItem).Caption);
end; procedure TForm1.dxNavBar1Item4Click(Sender: TObject);
begin
Addpage((Sender as TdxNavBarItem).Caption);
end; end.