To show a sheet in a window, use NSApplication to kick it off:[NSApp beginSheet: saveSheet modalForWindow: window modalDelegate: self didEndSelector: @selector(saveSheetDidEnd:returnCode:contextInfo:) contextInfo: NULL];In the controls in the sheet, use something like[NSApp endSheet: saveSheet returnCode: NSOKButton];To invoke thedidEndSelector
. Inside of that method, you can check the return code and decide what to do:- (void) saveSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo { if (returnCode == NSOKButton) { // ... } else if (returnCode == NSCancelButton) { // ... } else { // ... } [sheet close]; } // saveSheetDidEnd