[Lazarus] LCL Cocoa: Overriding delegate protocols

Zoë Peterson zoe at scootersoftware.com
Thu Oct 13 18:13:08 CEST 2016

I need to handle some delegate protocols in our application layer, which 
will require overriding things that the LCL Cocoa layer already 
implements in classes like TCocoaWindow.

In the Carbon interface, the equivalent was fairly easy, since 
TCarbonWSCustomForm.CreateHandle just creates a TCarbonWindow and passes 
it back, so it's trivial to implement a new CreateHandle that returns my 
descendant.  TCocoaWSCustomForm.CreateHandle, on the other hand, creates 
a TCocoaWindow and then does a bunch of extra work to set that window up.

I'd really rather not duplicate the entirety of TCocoaWS*.CreateHandle, 
especially since the interface is still immature.  It seems like the fix 
would be to move all of the CreateHandle code into a method in 
TCocoaWindow (possibly init), and if that's the case, we can certainly 
look into a patch to do that, but I'd like some direction from the devs 


Zoë Peterson
Scooter Software

More information about the Lazarus mailing list