[[lazarus] CreateComponent]

Samuel Liddicott sam at campbellsci.co.uk
Tue Aug 17 04:23:49 EDT 1999




> -----Original Message-----
> From: Michal Bukovjan [mailto:mbukovjan at netscape.net]
> Sent: 16 August 1999 08:13 PM
> To: lazarus at miraclec.com
> Subject: Re: [[lazarus] CreateComponent]
>
>
> In fact, the GTK object has to be created whenever the fComponent is
> addressed, which is in most messages that exist now.

In that case people should not refer to .fComponent, but .Handle (whose
getter calls HandleNeeded which actually creates the control.  I have
actually implemented all this in my copy and will be ready for checking in
soon by someone).

> One solution would be to make Component property and GetComponent
> it's read
> method, which would create the component on demand, or have a method like
> ComponentNeeded.

As you say. Delphi does this in handleneeded.

> The Windows way (of creating controls), however, is VERY different, which
> might be a problem.

They are different but it isn't actually a problem.  I once wrapped some C
graphing tools (Quinn Curtis - pretty nasty I thought) as Delphi controls
and they were like this, but it worked OK.

> In a Windows control (which is not OO), you
> supply nearly
> all controls' properties at CreateWindow(Ex), and whenever you
> want to change
> a property, you call RecreateWnd. (the rest goes through messages).

But in the end it doesn't matter if the visible properties (caption etc) are
set via messages or psuedo-properties.

> In GTK, the components are much like Delphi ones, i.e. they have a sort of
> pseudo-properties that can be changed through various functions
> (they are not
> classes or objects to preserve C compatibility, but if you look
> closely, they
> are VERY much like them. In fact, I think they were converted
> from what once
> was a C++ code), without the need (and in fact there is no such thing) to
> recreate control. Yes, you can destroy and then create the
> control once again,
> then setup all properties, but this is a DRAG.

Its not really a drag, its fully "automatic".  There is no problem with it
at all.

Sam






More information about the Lazarus mailing list