I've built a document-based app in Swift for MacOS. Hit Cmd-N (New File) N times, and N document windows are created (and cascaded). So far so good.
So I added a floating Palette window (and WindowController and ViewController, all in the storyboard), and wired up a menu command to call the AppDelegate to build it and show it, which works the first time. I marked it with the .floating
window level, and that seems to work too.
But Cmd-N is now causing new copies of the palette window, rather than the frontmost document window underneath the palette window, to be created. The new palette windows are cascaded too, even though my palette window controller is setting the cascade property to false
. And being floating, they show up behind the original floating palette window, which apparently takes precedence.
When the palette window shows up, it is the active window. If one clicks on a background Document window, it becomes active, and then Cmd-N works as expected.
What's the best way to direct the Cmd-N event towards making a new document? All this is happening under the hood without any code I've implemented, so where does one get one's hooks into it all?