Nswindow not updating
Usually, a window is made key when the user clicks it.Each application can have only one key window at a given time.In a Mac App that I’m currently developing for a client I need to be able to create modally presented windows as sheets as described here in Apple’s Human Interface Guidelines.Document Modal Dialogs or “Sheets” are instances of NSWindow.According to Apple’s documentation to present a custom NSWindow sheet we use the following code: Problem is begin Sheet:modal For Window:modal Delegate:did End Selector:context Info: was deprecated a few years ago and appears to no longer work in Yosemite and Mavericks With out-of-date documentation and all Googling resulting in out-of-date solutions to presenting custom modal windows, I went about figuring out the modern solution to this challenge!The replacement for begin Sheet:modal For Window:modal Delegate:did End Selector:context Info: is to now call begin Sheet:completion Handler: on the NSWindow that you want to present from, passing in reference to the instance of your custom NSWindow subclass.
Key-window status also moves from application to application as the active application changes.If the main and key window are different windows, they are distinguished from one another by the look of their title bars.Note the visual distinctions between main, key, and inactive windows in A good example of the difference between key and main windows can be seen in most well-behaved Mac apps.When developing i OS Apps it’s very rare to come up against a technical challenge that hasn’t already been solved and the solution shared on Stack Overflow or in Apple’s sample code in the i OS Dev Center.
Unfortunately I haven’t experienced the same luxury with Mac OS X Development.
Selecting “Save As...” in a text document, for example, displays a panel with a field to type the document’s name and a pull-down menu of locations to save it.