| View previous topic :: View next topic |
| Author |
Message |
Kevin Guest
|
Posted: Wed Jul 30, 2003 5:07 pm Post subject: Registering a component |
|
|
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
|
Posted: Wed Jul 30, 2003 7:30 pm Post subject: Re: Registering a component |
|
|
| 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
|
Posted: Wed Jul 30, 2003 11:39 pm Post subject: Re: Registering a component |
|
|
| 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 |
|
 |
|