The current NSWindowDelegate implementation in Delphi is very limited. It doesn't include events such as windowWillResize:toSize:
How can I extend it? I can see the code in source\rtl\osx'Macapi.Appkit.pas so I tried to make a copy of that file to my application folder and include it in the project.
However, after doing that I get lots of:
Unit FMX.[unit-name-here] was compiled with a different version of FMX.[other-unit-name-here].
What would be the appropriate way to extend it? How can I get rid of those errors?
You can create your own interface that adds the missing methods.
NSWindowDelegateEx = interface(IObjectiveC)
[{ Press Ctrl+Shift+G to insert a guid here }]
procedure windowDidEnterFullScreen(notification: NSNotification); cdecl;
function window(window: NSWindow; willUseFullScreenContentSize: NSSize): NSSize; cdecl; overload;
function window(window: NSWindow; willUseFullScreenPresentationOptions: NSApplicationPresentationOptions): NSApplicationPresentationOptions; cdecl; overload;
end;
When implementing the class that needs these additional methods, simply add your interface in addition to the interface that comes with Delphi.
TMyWindowDelegate = class(TOCLocal, NSWindowDelegate, NSWindowDelegateEx)
// ...
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With