[lazarus] Widget vs. Platform Independence

Michael A. Hess mhess at miraclec.com
Thu Sep 30 12:39:26 EDT 1999


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.

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. The only way it could be done would be to attach the GTK call
backs directly to the LCL object when it was created. Then the messages
from that widget would be returned to the LCL object and that object
only. The problem with this is that means we need to link GTK directly
to the LCL which then blows away the ability to use WIN32 which is what
you are after in the first place. The GTK callback routine must be a
CDECL procedure that is NOT part of a class. It can not be a method of a
pascal class.

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

Does that get you where you want to go? 

-- 
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mhess at miraclec.com   http://www.miraclec.com






More information about the Lazarus mailing list