[Lazarus] How to clone a component

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Oct 5 08:42:23 CEST 2012

On Thu, 04 Oct 2012 16:29:25 +0100
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> patspiper schrieb:
> > The copied (original) component's events are fine. However, it is the 
> > clone's events which are not as desired. Its methods code+data are equal 
> > to the original component's methods code+data whereas the data part 
> > should point to the clone itself for proper operation of the clone. Any 
> > ideas on how this should be handled?
> I don't think that the clipboard should contain pointers, which become 
> invalid as soon as the referenced form is closed.

The lfm stream does not contain pointers.
The reader has just the wrong root component.

> The data pointer should refer to the *form* containing the cloned 
> component. When that form doesn't have the named method, the handler 
> reference may be cleared.


More information about the Lazarus mailing list