Link to home
Start Free TrialLog in
Avatar of keron
keron

asked on

Easy Question!! 200 Points!

I use a pagecontrol,and a tabsheet on it with a richedit on the tabsheet.

Now in my program I want to Make new
tabsheets on the pagecontrol,each one
have the save properties with the source
tabsheet,same width,same height,and
the same Event procedure such as Onchange and so on.

and each of the tabsheets are noninterference.

how can i do it???
Avatar of rwilson032697
rwilson032697

Here is how you add a new tab sheet:

TheTabSheet := TTabSheet.Create(Self);
TheTabSheet.Parent := ThePageControl;
TheTabSheet.PageControl := ThePageControl;
TheTabSheet.Caption := 'Editor';

And add a TRichEdit to it like this:

ARichEdit := TRichEdit.Create(Self);
ARichEdit.Parent := TheTabSheet;
ARichEdit.Align := alClient;
ARichEdit.OnChange := MyOnChangeHandler;
etc with the other properties.

In the events you can use the Sender parameter to distinguich between the RichEdits.

Cheers,

Raymond.
Avatar of keron

ASKER

o£¡
the problem had make a little change
I use Twebbrower (IE Brower Control)
to instead of richedit to display html files and text files.
but when I try your code ,
Delphi  said that the twebbrower's
parent property is read only.
How can I do it???

Thanks a lot !!!!
:)
Avatar of keron

ASKER

How can i do???
It really a trouble!!

rwilson
waiting for your Opinion!
:)
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
May be better create own class inherited from the TTabSheet with all necessary properties and then use this class in run-time for creation any number identical sheets?

  TMyTabSheet = class(TTabSheet)
  private
    FRichEdit: TRichEdit;
    ...
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    ...
  end;

  constructor TMyTabSheet.Create(AOwner: TComponent);
  begin
    inherited;
    FRichEdit := TRichEdit.Create(...);
    ...
  end;

and so on.
Avatar of keron

ASKER

I love you rwilson!!!!
:P