On Nov 12, 2007, at 3:05 PM, Michael Van Canneyt wrote:



On Mon, 12 Nov 2007, Damien Gerard wrote:


On Nov 12, 2007, at 2:17 PM, Michael Van Canneyt wrote:



On Mon, 12 Nov 2007, Damien Gerard wrote:


Is there a way to clone objects/components ?

In C++ we use copy constructors, but in fpc/laz, I don't think there are
such
methods.
In fact I would like to create using the IDE a Panel with sub controls and
dupplicate it.
It is such a pain to write the code by hand.

But may be there is a specific way to do this

You can stream the panel and read the stream again for a new panel instance.


Thanks.
I use this : http://wiki.lazarus.freepascal.org/Streaming_components
However I ve got an exception error : Class "" not found (I put only a panel).

You should take care of 2 things:

1. You must give all components a name.


They all have a name due to they are created by the IDE.

2. All components that you want to stream must be registered using
  registerclass()

Ah ! That makes sense :)
I added RegisterClass(TPanel) just in case but I have still the error.
May be it is impossible with a TPanel.



--
Damien Gerard
[EMAIL PROTECTED]



_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to