Home > Back-end >  Delphi CopyComponent TabSheet dynamic replication control group, how to corresponding TabSheet Memo
Delphi CopyComponent TabSheet dynamic replication control group, how to corresponding TabSheet Memo

Time:11-02

Form inside a PageControl1 TabSheet1, Memo, and Button
For the code is: Memo1. Lines. The Add (' 1111111 ');

I use CopyComponent dynamic replication control group PageControl1. TabSheet1
New copy out the TabSheet (2)... TabSheet (N), there is also a Memo inside, and the Button
The problem is that some new copy Button, not on the Memo in the corresponding TabSheet operation, or in the original TabSheet1 Memo1. Lines. The Add operation, how to write the Button code should be on the Memo in the corresponding TabSheet operate?
For shameless!!!!!

Var
A: TTabSheet;
I: integer;
The begin
For I:=PageControl1. Downto PageCount - 1 1 do
PageControl1. Pages [I]. Destroy;
For I=1 to SpinEdit2. Value - 1 do//copy number
The begin
RegisterClasses ([TTabSheet, TMemo tbutton, tpagecontrol, tmap]);
A:=CopyComponent (TabSheet1 PageControl1, Self) as TTabSheet;
//a.C aption:=inttostr (gettickcount);
A.C aption:=Format (' window % d ', [I + 1));
UnRegisterClasses ([TTabSheet, TMemo tbutton, tpagecontrol, tmap]);
end;

The above code duplication TabSheet (2)... TabSheet (N), the Memo in the TabSheet of corresponding operation

CodePudding user response:

Don't copy the memo name memo1, your handling code is memo1 Lines. The Add (' 1111111 '); Of course will not display in the other memo

CodePudding user response:

Give you an idea:
First built a share button processing process, this process is complete you Memo1. Lines. The Add (' 1111111 '); Work, but not Memo1. Lines. The Add (' 1111111 '); , (please note that this process is very important in the process of the first step is to find their own parent controls TTabSheet, then find the TMemo under TTabSheet, then for the TMemo finish operation,

Then, when finished copy, just to point to the button events to build the sharing process,

CodePudding user response:

Copy and paste in the container control should pay attention to paste in what position, where remember to paste into focus, or in a mess, so I used and hurt,

CodePudding user response:

Separate defines a pointer to the process, the dynamic to the click event of each button from the assignment,

CodePudding user response:

refer to the second floor tanqth response:
give you an idea:
First built a share button processing process, this process is complete you Memo1. Lines. The Add (' 1111111 '); Work, but not Memo1. Lines. The Add (' 1111111 '); , (please note that this process is very important in the process of the first step is to find their own parent controls TTabSheet, then find the TMemo under TTabSheet, then for the TMemo finish operation,

Then, when finished copy, just to point to the button events to build the sharing process,



Have a code sample? The best of Delphi
  • Related