How Can I Post A Cocoa "sheet" On Another Program's Window?
Using the Apple OS X Cocoa framework, how can I post a sheet (slide-down modal dialog) on the window of another process?
Edit: Clarified a bit:
My application is a Finder extension to do Subversion version control (http://scplugin.tigris.org/). Part of my application is a plug-in (a Contextual Menu Item for Finder); the bulk of my application, however, is in a separate daemon proces. For several reasons, we've chosen to put virtually all the code into the daemon; the plug-in only defines the menu itself, and Apple-Events over to the Daemon.
Sometimes, the daemon needs to prompt the user for further information. It can toss a window on-screen for this, but that's disruptive (randomly positioned), and it seems to me the work flow here is legitimately modal, for example "select a file, pick 'commit' from the menu, provide commit comments, do the operation."
Interprocess cooperation (such as passing a reference of some kind) is acceptable: both processes are mine, but I want to avoid binding the sheet's code into the primary process.
Answer
Really, it sounds like you're trying to have your inter-process communication happen at the view level, which isn't really how Cocoa generally works. Things will be much easier if you separate your layers a bit more than that.
Why don't you want to put the sheet code into the other process? It's view code, and view code is inherently process-specific. The right thing to do here is probably to add somewhat generic modal-sheet support to your plugin code, and an IPC call that your daemon can make to summon that code. Trying to ship view objects over to the remote process is going to be nightmarish if you can make it work at all.
You're fighting the frameworks with this approach.
Related Questions
- → JavascriptCore: executing a javascript-defined callback function from native code
- → Flutter: Making Podfiles work
- → Can't import dependency installed with Cocoapods
- → Why does UITableView crash when I insert and delete at the same time?
- → How to enable UITextView to receive pasted images
- → Issue with Google Analytics via CocoaPods
- → What is the best practice to prevent an instance from init() in a Singleton class in Swift
- → JsonModelLib: Unable to parse if a variable does not exists in JSON
- → QueueScheduler not firing when interval is set
- → How to solve “bad interpreter: No such file or directory” error in iOS?
- → Xcode Safe Area Glitch With iPhone SE & 4s
- → How to observe en-/decrypting of data for a UIProgressView?
- → Files are not in project navigator eventhough project compiles and can search for them