Message Handling in LCL ?? (was Re: [lazarus] More Native Win32 stuff (Pascal, can you help here?)

Pascal Dutilleul pduti at yahoo.com
Tue Aug 10 04:06:24 EDT 1999


Hi,

As I understand in GTK, each component has to say for each message that
it will handle it, and give GTK a callback function that just handles
that message.

In Windows all messages are sent to the windowproc of the active
window, and if not handled, it is sent to the application window.


I haven't got the time to look at how messages from GTK are now handled
in the LCL.

I have quickly investigated it a bit (during my working hours, so my
boss won't be happy if he knew it).
What I think is that the TInterfaceObject (interfaces.pp) handles the
core difference between each toolkit.  Is there only one instance of
TInterfaceObject, or is it created for each component ?
 
It has something to do with IntSendMessage...

If I declare a 
  procedure MyHandler(...); message LM_MYMESSAGE;

How does LCL call MyHandler when it received the message ?

When a control is created, it calls InsertControl or AddControl.  Could
that be used to attach a windowproc ?

Somehow, we should first find out how messages are handled in the LCL
before we could do the windows stuff.  Could anybody help us explain
this ?


>   I was
> thinking of defining a TWindowObject and making the
> WindowProc a method,

I guess that's the way to go : see TInterfacedObject, that is inherited
from TgtkObject, TQTObject and maybe TWindowsObject ?

> then creating a new TWindowObject for each control
> when I recieve the
> LM_Create message, but I don't think I can assign a
> method to FWindowProc

Should FWindowProc not be published, so TWindowsObject could call/set
this function ?

> But it appears I can't create new, unique handlers
> for each component
> without them being part of the object to begin with.

Maybe this isn't necessary.  If you handle the messages in one global
procedure, you can 'perform' the message to the right object (if there
is a way to find the link between window-handles and the class.  When
you create a new window, you can give some pointer to it (in
pWinData?).) 
To be compatible with Delphi, the Perform function (should) exist ?


Pascal
_____________________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com






More information about the Lazarus mailing list