Forum > Cocoa

[Solved] Why TForm.OnDropFiles is not called on double-click in Finder?


I have a regression in CudaText editor: double-click in Finder, or 'Open with' in Finder - they don't call TFormMain.OnDropFiles with the clicked file. So editor cannot open associated document!

OnDropFiles _is_ still called OK when I drag-drop the document from Finder.
OnDropFiles _is_ still called OK in empty form demo. (So not a Lazarus regression.)
TForm.AllowDropFiles is on.

I cannot get the idea, what I broke.
.plist file is still the same (3 years).
macOS-specific code was not added to app in last years.
Any ideas?

macOS 10.8 and 11.x. Lazarus 2.2 release and 2.3 trunk.

Perhaps this paragraph from my Wiki article on macOS File and Custom URL Scheme Associations relates to your issue?

This wiki text tells
>It should be noted that the legacy keys are still working in macOS 10.15.4 (Catalina).

So my old Info.plist file must be OK for macOS 10.11 and 10.8. So, it is not the reason.

Solved. Reason is this: TForm.OnDropFiles indeed was not called because TApplication.MainForm=Nil at the time of Cocoa handler work! but TApplicationProperties.OnDropFiles was! COCOA code shows that it first tries to call TApplicationProperties.OnDropFiles.
I added this reaction and solved the bug.


[0] Message Index

Go to full version