Home > Back-end >  Use RzPageControl1 TAB create a window, how to shut down
Use RzPageControl1 TAB create a window, how to shut down

Time:04-21

I use RzPageControl dynamically create RzTabSheet1 (Caption='subject template'), and then put the window Form1 RzTabSheet1, in the following figure 1, but when close Form1 window (click "exit" button), RzTabSheet1 will not automatically shut down, should how to close the window, at the same time the cancellation RzTabSheet1? Under the great god, please give directions

Figure 1


Figure 2

CodePudding user response:

Supplement: I use language Delphi 7

CodePudding user response:

When you load the form, must be put the form on the RzPageControl, therefore RzPageControl form parent,
So, before you close the window to find the form of the parent controls, if RzPageControl, shut him,

CodePudding user response:

Form1:=TForm1. Create (RzTabSheet1);//the Owner at the specified Form1 RzTabSheet1, making RzTabSheet1 released automatically release Form;

In Form1 "exit" button event handler:
Procedure TForm1. ButtonExitClick (Sender: TObject);
The begin
The Self. The Parent. Free;
end

CodePudding user response:

 unit UnitMain; 

Interface

USES the
Winapi. Windows, Winapi Messages, System. SysUtils, System. Variants,
System. The Classes, the Vcl. Graphics, Vcl. Controls, Vcl. Forms, Vcl. Dialogs,
RzTabs, Vcl. StdCtrls;

Type
TFormMain=class (TForm)
RzPageControl1: TRzPageControl;
TabSheet system navigation: TRzTabSheet;
Procedure FormCreate (Sender: TObject);
Private
RzTabSheet1: TRzTabSheet;
Public
{Public declarations}
end;

Var
FormMain: TFormMain;

Implementation

{$R *. DFM}

USES unit1;

Procedure TFormMain. FormCreate (Sender: TObject);
The begin
RzTabSheet1:=TRzTabSheet. Create (RzPageControl1);
RzTabSheet1. PageControl:=RzPageControl1;
RzTabSheet1. Caption:='subject template;
RzTabSheet1. TabVisible:=TRUE;
RzPageControl1. ActivePage:=RzTabSheet1;
Form1:=TForm1. Create (RzTabSheet1);//is the Owner of the specified Form1 RzTabSheet1
Form1. Parent:=RzTabSheet1;
Form1. Align:=alClient;
Form1. Show;
end;

End.

 unit Unit1; 

Interface

USES the
Winapi. Windows, Winapi Messages, System. SysUtils, System. Variants,
System. The Classes, the Vcl. Graphics, Vcl. Controls, Vcl. Forms, Vcl. Dialogs,
The Vcl. StdCtrls;

Type
TForm1=class (TForm)
For: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
The begin
The Self. The Parent. Free;
end;

End.
  • Related