Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-08

[RE: [CreateComponent]]

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Samuel Liddicott
to Michal Bukovjan: Well, this might be good if it somewhat glues together the differences between Win32 and…
Show quoted text 9 lines
-----Original Message----- From: Michal Bukovjan Sent: 17 August 1999 12:22 PM To: Subject: Re: [RE: [[lazarus] CreateComponent]] Well, this might be good if it somewhat glues together the differences between Win32 and Gtk/Qt/whatever. I am curious :-)

It does/will

Show quoted text 11 lines
> > 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.

ah, yes.

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

You are right, all child windows are re-created too (automatically of course)

3. You have to remember most of the properties and then re-assign them, which is NOT automatic.

As you say.

Show quoted text 8 lines
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.

This is how Delphi does it

Show quoted text 6 lines
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).

It is usually only properties that affect the fundamental appearance that cause a re-createwnd - it actually rarely happens. Changing border does it for one, but we MUST support this for other reasons: It should be possible to remove a TListBox so it has no parent, and then assign it to a parent in ANOTHER FORM and still keep it's contents.

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

RecreateWnd itself will not be needed for GTK, but the things it uses to do its tricks will be needed, as in above about moving listbox to another form. But its just donky work, nothing difficult about it. And the slow-down only occurs when it is used - rarely but when it is used it is needed and a work-around would be even worse. I will manage/check this if you want.

Sam

Reply by email

Michal Bukovjan
"Samuel Liddicott" wrote 17 lines
> -----Original Message----- > From: Michal Bukovjan > Sent: 16 August 1999 08:13 PM > To: > 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 :-)

Show quoted text 6 lines
> 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.

Show quoted text 7 lines
Sam _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email