Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
Clicking an application's red close button up in it's top left corner, does this create the same event that is generated by using the Quit Menu option?
 
Depends. If your application is a "single window" type, then the answer is yes. If it's document-based, and thus has one window for each open document, then no.
 
99% of the time, clicking the red circle doesn't close an application. When I came from a pc a couple years ago, I was confused by that too
 
If you have a single-window type application and want it to shut down if the main window is closed, you can modify your application delegate by adding the following method:

Code:
// Stop the application when all windows have closed.
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
    return TRUE;
}


Then the application will quit when the last window closes. The System Preferences app is an example of this behavior.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.