[Lazarus] When do I need a component rather than a plain object?

Steve Smith stevie at collector.org
Mon Nov 15 22:36:38 CET 2010


Message: 5
Date: Mon, 15 Nov 2010 16:32:34 +0100
From: Bo Berglund <bo.berglund at gmail.com>
Subject: Re: [Lazarus] When do I need a component rather than a plain
    object?
To: lazarus at lists.lazarus.freepascal.org
Message-ID: <ruj2e61613s285b5pj9ieitbf2qld9d56k at 4ax.com>
Content-Type: text/plain; charset=us-ascii

On, 15 Nov 2010 16:32:34 +0100, Bo Berglund <bo.berglund at gmail.com>
wrote:

> According to what I have read in the WIKI you only install components
> into Lazarus if they are visual and you really need them to be part of
> a visual form.

> In all other cases you should not install a component in the IDE,
> instead you instantiate the objects from that component in code.

You create and install a component, not because it is visual or 
non-visual
but because you wish to use it in the visual forms designer in Lazarus,
just as in Delphi.  For example TTimer is not a visual component, but
because you wish to add it to the component palette and add it to your
form, it has to be a descendent of TComponent.

If you are creating a visual component it should be a descendent of
TControl or one of it's descendants.

TPersistent is the base class that implements support for the streaming
subsystem used by the forms designer and it's components to save their
properties in the form file.

If you don't wish any of these facilities, you can use TObject.




More information about the Lazarus mailing list