cocoa - How to make a keyboard shortcut to close dialog with Xcode/Interface Builder? -


It looks very basic but goes here if you are keyboard-oriented, then you can close windows in OS X all the time Is used to use Command-W for I want to add that ability to the interface builder for my program. I can see how to add the same keyboard as a button action but what if I do not have any buttons?

Should I add an Invisible Button and Shortcut to it? Clanky looks definitely is just some method I can override, but what I have tried is not working yet.

when you press command + w , Then this file - & gt; The choice is similar. Turn off from the menu bar Close sends a message to the first responder. In return, it will check whether the receiver or receiver representative is implemented, and if it returns yes the window will be closed (otherwise, this code will close the method Will call).

So in reality, it depends on what type of communication you will get? If this is non-modal (essentially, if you are running, you can access the menu bar) and this is an example or sub-class of NSWindow You can override the windowShouldClose: In the representative of your dialogue method (or your communication class, if you are under NSWindow or some other category) Code> yes back.

However , if the dialog is a modal dialog (you can not access the menu bar, switch window, etc., the dialog is running), then you can do it like this Can not. You can add an invisible button , but in all honesty, a modal dialog should not be stopped by hitting Command-W , because it definitely requires some apple interface guidelines Is violated. (Especially since, Andy said, Esc is a standard practice to close / cancel the dialogue.)


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -