[lazarus] Widget vs. Platform Independence

Jeff Wormsley daworm at cdc.net
Thu Sep 30 14:19:31 EDT 1999


On 30.09.99, at 1:03 PM, Shane Miller wrote: 

>But why not have the call back function simply call  TControl(self).wndproc or something like that.
>
>For example, once the callback gtkshowCB(widget ... ; Data ...;) is called the code would be....
>var
>msg : TMessage
>begin
>TControl(data).wndProc(msg);
>end;

This breaks the independence.  If you translate GTK to LCL in Interfaces, then the LCL components only ever get LCL messages.  You do the same for Win32, you translate Win32 messages to LCL messages in Interfaces.  The WindProc in LCL always gets LCL messages, regardless of whether you are using GTK or Win32 or whatever widget set you want.

>Now, the problem I see is that if we have a component that isn't declared from TControl, but we can get around that by checking what type the DATA is.  

The translation object would have to be different for each component class, I think.  A TButton wouldn't need nearly as many callbacks or messages as, say, a TDBLookupCombo.  By focusing on just what is needed, you can keep it pretty fast.  The limitation is that the application programmer cannot override or attach a handler to something we as LCL/Interface designers did not provide a translation/callback for.  That is a limitation already with our GTK, so it is no big deal.

Jeff.







More information about the Lazarus mailing list