BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Registering a component

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Kevin
Guest





PostPosted: Wed Jul 30, 2003 5:07 pm    Post subject: Registering a component Reply with quote



I wrote a component and registered it but when I try to instantiate it from
the palette it says
"Control '' has no parent window." I derived the new class from
TCustomControl and based my code on a control that I had already
instantiated successfully. I have very little experience with this so I'm
probably missing something obvious but I can't get it to work. Any ideas?


Back to top
Jens Gruschel
Guest





PostPosted: Wed Jul 30, 2003 7:30 pm    Post subject: Re: Registering a component Reply with quote



Quote:
"Control '' has no parent window." I derived the new class from
TCustomControl and based my code on a control that I had already
instantiated successfully.

Do you call the inherited constructor when overriding the constructor?

Jens





Back to top
Kevin
Guest





PostPosted: Wed Jul 30, 2003 11:39 pm    Post subject: Re: Registering a component Reply with quote



Quote:
Would you mind posting the code from the constructor? You are probably
doing
something that forces a paint event before the Parent is set.
Okay, it follows. I'm calling inherit immediately, though. Also, this code

is based on a component that didn't have this problem. I've added a
property, a couple of procedures and a function but the structure hasn't
really changed. Could the order of the declarations/implementations be
involved?

constructor TKTrackBar.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
Width := 150;
Height := 50;
TabStop := True;
FMax := 10;
FMin := 0;
FPosition := 0;
FSmallChange := 1;
FLargeChange := 2;
FOrientation := toHorizontal;
FTrackSize := 10;
FTrackStyle := trLowered;
FTrackColor := clWhite;
FThumbSize := 20;
FThumbStyle := tsRaisedRectangle;
FThumbColor := clBtnFace;
FTickSize := 6;
FTickStyle := tiRaisedRect;
FTickColor := clBtnFace;
FTickOrientation := toBoth;
FTickInterval := 1;
FDitherThumb := True;
FTracking := False;
FOldThumbX := MaxInt;
FOldThumbY := MaxInt;
FBackgroundBmp := TBitmap.Create;
FThumbBmp := TBitmap.Create;
FMaskBmp := TBitmap.Create;
FTickBmp := TBitmap.Create;
FDitherBmp := TBitmap.Create;
FDitherBmp.Width := 8;
FDitherBmp.Height := 8;
//K Changed: Add FMarginSize
FMarginSize := 7;
UpdateThumbData;
UpdateTrackData;
UpdateTickData;
UpdateDitherBitmap;
end;




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.