[RE: [[lazarus] CreateComponent]]

Michal Bukovjan mbukovjan at netscape.net
Tue Aug 17 05:17:08 EDT 1999


"Samuel Liddicott" <sam at campbellsci.co.uk> wrote:
> 
> 
> > -----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).
> 
Well, this might be good if it somewhat glues together the differences between
Win32 and Gtk/Qt/whatever. I am curious :-)


> > 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.

It is a DRAG (tm), becuase (in case of recreating GTK control):

1. Memory must be reallocated, may cause memory fragmentation.
2. Children controls, as well as parent will have to be informed of that
(which is automatic, but still it is a overhead), some of them being destroyed
along the way (unless someone rewrites the GTK libs).
3. You have to remember most of the properties and then re-assign them, which
is NOT automatic. In fact, many of the properties (like Items) are held only
within the control (not in Lazarus wrapper), and once you destroy the control,
you have to keep a copy in memory :-(, then re-assign them as well. BTW, the
same applies to Delphi and Win32 stuff.

I don't know what they do in Win32 when re-creating handles/controls, but that
might be one of the reasons why Windows is so slow. (Although I admit that in
real world application, you usually do not change many properties on-the
fly).

Again, I am talking about GTK, not Win32. So the best solution for RecreateWnd
for GTK would be to be ignored.


> 
> Sam
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list