Sign in Join

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

Mailing lists / lazarus / 1999-08

[CreateComponent]

3 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: In fact, the GTK object has to be created whenever the fComponent is addressed, which is…
Show quoted text 9 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).

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.

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

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

Reply by email

Michal Bukovjan

In fact, the GTK object has to be created whenever the fComponent is addressed, which is in most messages that exist now.

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.

The Windows way (of creating controls), however, is VERY different, which might be a problem. 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).

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.

Take that into consideration,

Michal Bukovjan

"Samuel Liddicott" wrote 16 lines
It seems like (to pick an example) TLabel makes it's GTK object in the contructor. This is a bit early. Can't we delay gtk-creation until HandleNeeded is called? Its the Delphi way. In fact can't we do it in the CreateWindow function? Am I being too fussy spotting windows divergances here? - but this one is important to me. Sam _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michal Bukovjan

[snip]

stdwndproc - but also used by the FindControl function, which returns the delphi control associated with a given handle. Can we store tags inside a given GTK control?

Yes, any GtkObject can hold any number of arbitrary data. See gtk_object_get_data and gtk_object_set_data

Michal Bukovjan

Reply by email