Shebuka
Shebuka

Reputation: 3248

How to close an NSWindow on Cmd+W without Menu Shortcut?

i'm porting a Windows application to Mac OS X Cocoa and it must be as similar as possible, so there is no "Close Window" Menu Item with a binded Shortcut in my menu.

But still i would like to be able to close them by Cmd+W Shortcut, is there a way to do this without handling keyDown event?

Upvotes: 5

Views: 1706

Answers (1)

Shebuka
Shebuka

Reputation: 3248

Ultimately i've implemented the Close menu item in my Main Menu that sends performClose to First Responder and has the Cmd+W shortcut.

Upvotes: 5

Related Questions