Reputation: 951
Which actions are fired when user uses default NSOpenPanel from Main Menu? How to get the selection from it without creating NSOpenPanel in the code?
Upvotes: 0
Views: 119
Reputation: 16660
A.
Which actions are fired when user uses default NSOpenPanel from Main Menu?
There is no NSOpenPanel
in the main menu. There is a menu item "Open…"
The automatism you might "feel" is implemented project dependently. But it is not there automatically. I think that some points has to be clearified:
a. Open Menu Item
The menu item "Open…" sends and only sends the action message openDocument:
to the first responder. "Open…" does not open a panel, window dialog or $whatever.
Please get some information about first responders and the responder chain. It is a pity, that even the responder chain is one of the core concept of Cocoa, it is very unknown.
b. Open Panel
If you choosed to have a document based application, when you created the project, some additions are made to your project. In particular,
NSDocumentController
is instantiated automatically.Since NSDocumentController
implements -openDocument:
, it will catch the action message and
NSDocument
. (More precise: of the subclass you selected as the document class.)B.
How to get the selection from it without creating NSOpenPanel in the code?
Upvotes: 1