Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Constructor's next call?

Status
Not open for further replies.

rcloutie

Programmer
May 26, 2005
164
CA
Hi there,

Having a vcl based on another control. Need to initialize some variables once. So put initialization into Create constructor.

The problem is that some properties (set at design time)
are not set yet within the constructor (even if the first line is 'inherited Create(AOwner);').

Here's some example,
1- TPageControl always have PageCount=0;
2- TStringGrid always have Options=[goFixedVertLine ..
goRangeSelect]
3- TTreeView always have Items.Count=0;

Is there any way to catch up, once in the life
of a visual component, the moment where all
properties are set as design time?

Someone in this forum already told me to override
procedure ReadState(Reader: TReader); but it
doesn't work: in ReadState proc the three case
above still true.

Thanks for reply,

Rej Cloutier
 
Have you tried the default option for those published properties?
 
Hi Griffyn!

Thanks, it's a good idea for TStringGrid.Options, will give a try... Therefore, it will not work for TPageControl.PageCount neither TTreeView.Items.Count...

 
There's also an AfterConstruction method for all objects I think. Try overriding that and settings your variables there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top