The open-file Apple Event may contain a parameter for a search term. After opening a file for a document, if there is a search term, and the document window supports searching, then fill in the window’s search field with the event’s search term.
The guide for "NSDocument.canConcurrentlyReadDocuments(ofType:)” mentions that your opening routine can’t get access to the Apple Event when running in multi-threaded mode. So they suggestion not activating that mode for your document class if you need to inspect the search term. But couldn’t you do that in NSDocumentController instead? Right now, I’m pulling the trigger on concurrent opening. Then I’m thinking of overriding “NSDocumentController.openDocument(withContentsOf: display: completionHandler:)". Before calling super, I would check the Apple Event then to extract any search term. Then I would write a closure that checks if a document matches a custom protocol, and if the document class matches, use the protocol to pass the search term to the document. This new closure wraps the completionHandler argument already given and will be the handler passed on to super instead. That seems OK to work (in my head, at least). — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com