Home > Back-end >  Open the tabsheet PageControl
Open the tabsheet PageControl

Time:09-16




Is how to open after the rz controls close
 
The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzTabs ExtCtrls, RzPanel RzButton, RzSplit, StdCtrls;

Type
TForm1=class (TForm)
RzSplitter1: TRzSplitter;
RzPanel1: TRzPanel;
RzPageControl1: TRzPageControl;
TabSheet1: TRzTabSheet;
TabSheet2: TRzTabSheet;
TabSheet3: TRzTabSheet;
TabSheet4: TRzTabSheet;
TabSheet5: TRzTabSheet;
TabSheet6: TRzTabSheet;
RzButton1: TRzButton;
RzButton2: TRzButton;
RzButton3: TRzButton;
RzButton4: TRzButton;
RzButton5: TRzButton;
RzButton6: TRzButton;
TabSheet7: TRzTabSheet;
Label1: TLabel;
Procedure RzButton6Click (Sender: TObject);
Procedure RzButton5Click (Sender: TObject);
Procedure RzButton4Click (Sender: TObject);
Procedure RzButton3Click (Sender: TObject);
Procedure RzButton2Click (Sender: TObject);
Procedure RzButton1Click (Sender: TObject);
Procedure RzPageControl1Close (Sender: TObject;
Var AllowClose: Boolean);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. RzButton6Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=0;
//TabSheet1. TabVisible:=true;
end;

Procedure TForm1. RzButton5Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=1;
TabSheet2. TabVisible:=true;
end;

Procedure TForm1. RzButton4Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=2;
TabSheet3. TabVisible:=true;
end;

Procedure TForm1. RzButton3Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=3;
TabSheet4. TabVisible:=true;
end;

Procedure TForm1. RzButton2Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=4;
TabSheet5. TabVisible:=true;
end;

Procedure TForm1. RzButton1Click (Sender: TObject);
The begin
RzPageControl1. ActivePageIndex:=5;
TabSheet6. TabVisible:=true;
//TabSheet6.

end;

Procedure TForm1. RzPageControl1Close (Sender: TObject;
Var AllowClose: Boolean);
The begin
AllowClose:=True;

end;

End.


Using rzpagecontrol showclosebuttononactivetab attribute

How yao realize close open

Close the tag * symbol

Open in button to open the great spirit action!!!!!!!!!!!!!!
Before using a hidden but there are a few small problems

CodePudding user response:

Controls the Close time change
 procedure TForm1. RzPageControl1Close (Sender: TObject; 
Var AllowClose: Boolean);
The begin
RzPageControl1. ActivePage. TabVisible:=false
//if necessary to specify the current page
end;

CodePudding user response:

Shw014 hello before it is for this but this statement has a bug

Click the close button only a label to hide the page also shows in where

CodePudding user response:

Made similar before, my train of thought is that
1, create a new TAB page code
 
The class function TSMUIDrv. LoadFuncForm (parent: TRzPageControl; ClsName: string) : TAWin;
Var
I, j: integer;
TMP: TComponent;
SHT: TRzTabSheet;
The begin
//form exists?
For I:=0 to the parent. Do PageCount - 1
The begin
For j:=0 to the parent. The Pages [I] do ControlCount - 1
The begin
. If the parent Pages [I] Controls [j]. Journal of ClassName=clsName then
The begin
The parent. ActivePageIndex:=I;
Result:=TAWin (parent Pages [I] Controls [j]);
exit;
end;
end;
end;
//to load new form
SHT:=TRzTabSheet. Create (parent);
SHT. PageControl:=the parent;
TMP:=LoadComponent (clsName, SHT);
If tmp<> Nil then
The begin
Result:=TAWin (TMP);
Result. The Parent:=SHT;
TAWin (TMP). BorderStyle:=bsNone;
SHT. Caption:=TAWin (TMP). The Caption;
Result. The Align:=alClient;
SHT. Tag:=TAWin (TMP). The Tag;
Result. The Show;
Parent. ActivePageIndex:=parent. PageCount - 1;
End
The else begin
SHT. Free;
Result:=nil;
end;
end;

2, close the window
 

Procedure TFmMain. OnCloseActivePage (sender: TObject; Var allowClose: Boolean);
Var
I: integer;
The begin
For I:=0 to pcCtl. ActivePage. Do ControlCount - 1
The begin
If (pcCtl. ActivePage. Controls [I] is TAWin) then
The begin
If TAWin (pcCtl. ActivePage. Controls [I]), Dirty and
(TSMSystem MessageBox (' data is not saved, shut down? ', MB_ICONQUESTION or MB_YESNO)=IDNO) then
The begin
AllowClose:=false;
exit;
end;
TAWin (pcCtl. ActivePage. Controls [I]), Free;
AllowClose:=true;
end;
end;
end;


3, the running effect
nullnull
  • Related