[lazarus] Widget vs. Platform Independence

Samuel Liddicott sam at campbellsci.co.uk
Thu Sep 30 13:00:46 EDT 1999

> -----Original Message-----
> From: Michael A. Hess [mailto:mhess at miraclec.com]
> Sent: Thursday, September 30, 1999 05:51 PM
> To: lazarus at miraclec.com
> Subject: Re: [lazarus] Widget vs. Platform Independence
> Samuel Liddicott wrote:
> >
> > Michael I am saying we should take the GTK callback handlers we now
> > have (you wrote them?) and have THEM call .wndproc instead of
> > .dispatch.
> The problem is, what wndproc does it call? Which control or component is
> it suppose to call? That is what dispatch does. It is a lower level RTL
> feature of all classes (objects). The dispatch routine is what routes
> the call to the correct control (object). In other words if you had a
> form with 3 buttons on it and a button click message was returned by a
> GTK button widget, which LCL button does it report to? The message from
> GTK doesn't know. All it contains is the Self pointer established when
> the LCL class was created. The only way it can send the message to the
> correct LCL control is to call dispatch which can determine from the
> table that FPC creates which LCL object should be called with the
> message.

OK, once you have done this, call Control.WndProc
My use of dispatch was refering to TControl.Dispatch (the delphi message
Any GTK dispatch calculations were done in the GTK unit I thought.  But yes,
look up the control as normal, and then call its wndproc.  The wndproc will
end up calling the delphi .dispatch which will call all the delphi message

> That is why I asked whether you want to use a global wndproc or one for
> every object. A global could be done. One for every object can't easily
> be done.

You manage to calculate the LCL object somehow.  All I am saying is call its
.wndproc once you have.

> What you would have to do is create a message for the LCL controls (I
> guess the base class) that is the wndproc method. then you would have to
> have all messages (signals) that come in from GTK be sent to the
> Dispatch
**** [this must be a different dispatch to the delphi .dispatch - more
> which would call the wndproc for the correct object. Then this
> wndproc method would have to have a large case statement to deal with
> every kind of message that needs to be dealt with.

No, because the the .wndproc doesn't do much except call the delphi message
dispatcher.  but it does do some other things.

> Does that get you where you want to go?


This is the way delphi works

WINDOWS MESSAGE -> StandardWndProc** -> TXXXControl.WndProc[virtual] ->

StandardWndProc is make using MakeObjectInstance, it is the glue between the
winapi and delphi, it is a flat (object-less) routine that calls an object

We need a similar glue that takes a GTK callback, looks up the related
object (as we do now) and then calls its wndproc.

This is a very slight change to what we do now, but I think the words are
getting in the way.


More information about the Lazarus mailing list