Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-10

LCL Cocoa: Overriding delegate protocols

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zoë Peterson

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

Thanks,

Zoë Peterson
Scooter Software

Reply by email

Graeme Geldenhuys
to Zoë Peterson
Zoë Peterson wrote
It seems like the fix would be to move all of the CreateHandle code into a method in TCocoaWindow (possibly init)

I'm not a core Lazarus developer, but your suggestion does sound like a good solution without down sides. One method doing multiple things is never a good design choice, so splitting it up definitely seems the right way to go.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email