isaka
asked on
Creating TMyPageControl component
What I want to do is creating a Custom component descendant from TPageControl like:
TMyPageControl = class(TPageControl)
but what I realy need is inserting new property items on TTabSheet control like:
TMyTabSheet = class(TTabSheet)
property Item1;
property Item2;
property Item3;
and this TMyTabSheet to be linked with TMyPageControl.
So how can I link this to controls and to function on the same way as TPageControl?
Thank you
TMyPageControl = class(TPageControl)
but what I realy need is inserting new property items on TTabSheet control like:
TMyTabSheet = class(TTabSheet)
property Item1;
property Item2;
property Item3;
and this TMyTabSheet to be linked with TMyPageControl.
So how can I link this to controls and to function on the same way as TPageControl?
Thank you
here I have an example clipped from a text editor I have written:
TMySheet = class(TTabSheet)
private
fFileName : string;
procedure setFileName(value : string);
public
text : TRichEdit;
property fileName : string read fFileName write setFileName;
constructor create(AOwner : TComponent);override;
end;
constructor TMySheet.create(AOwner : TComponent);
begin
inherited;
text := TRichEdit.create(self);
text.parent := self;
text.align := alClient;
text.modified := false;
text.ScrollBars := ssBoth;
text.PlainText := form1.CheckBox1.Checked;
form1.toolbutton3.down := form1.checkbox1.checked;
text.WordWrap := form1.checkbox5.checked;
form1.toolButton2.Down := form1.checkbox5.checked;
text.WantTabs := true;
text.WantReturns := true;
fFileName := '';
end;
procedure TForm1.New1Click(Sender: TObject);
var
t : TMySheet;
begin
t := TMySheet.create(noteBook);
with t do
begin
parent := notebook;
pageControl := noteBook;
end;
notebook.ActivePage := t;
noteBookChange(self);
end;
GL
Mike
TMySheet = class(TTabSheet)
private
fFileName : string;
procedure setFileName(value : string);
public
text : TRichEdit;
property fileName : string read fFileName write setFileName;
constructor create(AOwner : TComponent);override;
end;
constructor TMySheet.create(AOwner : TComponent);
begin
inherited;
text := TRichEdit.create(self);
text.parent := self;
text.align := alClient;
text.modified := false;
text.ScrollBars := ssBoth;
text.PlainText := form1.CheckBox1.Checked;
form1.toolbutton3.down := form1.checkbox1.checked;
text.WordWrap := form1.checkbox5.checked;
form1.toolButton2.Down := form1.checkbox5.checked;
text.WantTabs := true;
text.WantReturns := true;
fFileName := '';
end;
procedure TForm1.New1Click(Sender: TObject);
var
t : TMySheet;
begin
t := TMySheet.create(noteBook);
with t do
begin
parent := notebook;
pageControl := noteBook;
end;
notebook.ActivePage := t;
noteBookChange(self);
end;
GL
Mike
ASKER
Thank you Mike on you answer,
But in this way I can't make a component which work at design time.
isak
But in this way I can't make a component which work at design time.
isak
ASKER
Adjusted points from 50 to 100
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works perfect.
Thank you for your brilliant answer.
Thank you for your brilliant answer.
Gl
Mike