[lazarus] Setting callbacks

Marc Weustink weus at quicknet.nl
Sun Dec 5 13:58:39 EST 1999


At 13:12 05-12-99 -0500, you wrote:
>Marc Weustink wrote:
>> 
>> The set of CallBacks is per ComponentStyle allways fixed, so why not
>> doing this after to (gtk/qt/win/whatever)component is created (and
>> move this out of LCL since IMHO it doesn't belong there)
>
>Why do you think this????

Difficult to tell. That was the reason I posted the original message. I
didn't have a clear vision, but I'll try. (The more I think about it, the
more I'm in doubt)

I now see two options:
1) The callbacks are set at one place at the lowest possible class level,
based upon the compstyle. In our case this would be T(Win)control.

2) The callbacks are set the way it is done now. Every control set the
event it needs.


In my thoughts you always wanted all the events possible, so that, as a
developer in a later stage, you don't have to take care of "asking' for
events.
If you do want that, what place knows better what events there are?... The
interfaceobjects. So in my original message I saw just a routine that,
based upon Compstyle, set the callbacks.
This way you just get your messages, you can handle them if you want. Like
Delphi, I don't ask for events, they are just there.
And if you want to handle a message wich isn't there... bad luck. It's like
Windows, if you want to handle say WM_SETFOCUS in a TLabel, be my guest,
but you wont get many messages.

Another point is platform dependency. You allways want the same set of
messages. That pleads for a routine in LCL. So you can assure the same
messageset is available on every platform

Now I start to see that here Lazarus might differ from Delphi. I think that
you might not want every possible event. 

The point is I resumed my work on TWinControl.CreateWnd (mwEdit didnt get
any events) and I dived into loads of double/triple calls to the same
SetCallBack, unused callbacks, events being there and no callback
set...etc. I allmost drounded.

If this is indeed the point where LCL differs from VCL, I'll introduce
T(win)Control.AttachEvents and T(win)Control.DetachEvents and that would be
the place to call SetCallBack

>
>Where would you think they should be???

See previous

Marc







More information about the Lazarus mailing list