Excellent, works great. 

Thanks for that Cheng.

-----Original Message-----
From: Cheng Wei [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 3 May 2001 14:27
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Parent question


Try this James,

constructor TFrameButton.Create(AOwner : TComponent);
begin
   inherited Create(AOwner);
   Parent := TWinControl(AOwner);      // <---
   FBevel := TBevel.Create(AOwner);
   FBevel.Top := Top - 4;
   FBevel.Left := Left - 4;
   FBevel.Width := Width + 8;
   FBevel.Height := Height + 8;
   FBevel.Parent := Parent;
   Flat := True;
   BringToFront;  // <---
end;

Regards
Cheng

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of James Sugrue
Sent: Thursday, 3 May 2001 13:45
To: Multiple recipients of list delphi
Subject: [DUG]: Parent question


I had a question this morning that I will rephrase to try and make it a bit
more understandable.

I want to make a component, which is a TSpeedButton with a TBevel around the
outside.

I.E

TFrameButton = class(TSpeedButton)
private
   FBevel : TBevel
public
   constructor Create(AOwner : TComponent); override;
end;

constructor TFrameButton.Create(AOwner : TComponent);
begin
   inherited Create(AOwner);
   FBevel := TBevel.Create(AOwner);
   FBevel.Top := Top - 4;
   FBevel.Left := Left - 4;
   FBevel.Width := Width + 8;
   FBevel.Height := Height + 8;
   FBevel.Parent := Parent; { this is my problem. Not sure what I should
have here}
   Flat := True;
end;

If I test this by doing

procedure TForm1.Button1Click(Sender : TObject);
var
   FrameButton : TFrameButton;
begin
   FrameButton := TFrameButton.Create( Form1);
   FrameButton.Parent := Form1;
end;

Above shows button but not frame but if I include :

FrameButton.FBevel.Parent := Form1; { it shows the Bevel}

I know why it is doing this, but I don't know what I should pass as the
parent in the constructor....


Cheers
end;



CAUTION - This message may contain privileged and confidential information
intended only for the
use of the addressee(s) named above.  If you are not the intended recipient
of this message you are
hereby notified that any use, dissemination, distribution or reproduction of
this message is prohibited.
If you have received this message in error please notify Progressive
Enterprises Ltd. immediately via
email at [EMAIL PROTECTED]  Any views expressed in this
message are those of the
individual sender and may not necessarily reflect the views of Progressive
Enterprises Ltd.

This footnote also confirms that Progressive Enterprises Ltd. has swept this
email message for the
presence of computer viruses.  This does not guarantee this message is virus
free.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"



CAUTION - This message may contain privileged and confidential information intended 
only for the 
use of the addressee(s) named above.  If you are not the intended recipient of this 
message you are 
hereby notified that any use, dissemination, distribution or reproduction of this 
message is prohibited.  
If you have received this message in error please notify Progressive Enterprises Ltd. 
immediately via 
email at [EMAIL PROTECTED]  Any views expressed in this message 
are those of the 
individual sender and may not necessarily reflect the views of Progressive Enterprises 
Ltd.

This footnote also confirms that Progressive Enterprises Ltd. has swept this email 
message for the 
presence of computer viruses.  This does not guarantee this message is virus free.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to