Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How can i duplicate a TShape preserving its properties?



Permlink Replies: 2 - Last Post: Jan 3, 2017 10:10 AM Last Post By: Remy Lebeau (Te...
Damian Craiem

Posts: 5
Registered: 10/9/13
How can i duplicate a TShape preserving its properties?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 11:18 AM
Hello,
I have a TShape object (Shape1) inside a Panel (Panel1) and I want to create another TShape (Shape2) with the same properties as Shape1. I've tried to use the Assign method without success:

TShape *Shape2 = new TShape(Panel1);
Shape2->Assign(Shape1);

Can anyone help?
Thanks in advance.
D

Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: How can i duplicate a TShape preserving its properties?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 3:30 PM   in response to: Damian Craiem in response to: Damian Craiem
Hi Damian

Damian Craiem wrote:

Hello,
I have a TShape object (Shape1) inside a Panel (Panel1) and I want to create
another TShape (Shape2) with the same properties as Shape1. I've tried to use
the Assign method without success:

As far as I know you can't.
You have to set the properties in code.

Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How can i duplicate a TShape preserving its properties?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 3, 2017 10:10 AM   in response to: Damian Craiem in response to: Damian Craiem
Damian wrote:

I have a TShape object (Shape1) inside a Panel (Panel1) and I want to
create another TShape (Shape2) with the same properties as Shape1.

You will have to copy the individual properties one at a time, either manually
in code or by using RTTI to enumerate the properties.

I've tried to use the Assign method without success:

That is because most classes, including TShape, do not implement Assign()
at all.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02