On Mon, Jan 18, 2010 at 10:04 PM, Quincey Morris <quinceymor...@earthlink.net> wrote: > On Jan 18, 2010, at 11:23, Andreas Eriksson wrote: > >> What's the recommended way of keeping a window in the Window menu >> (like e.g. Address book and iChat does) so that it can be brought back >> even after it has been closed? > > Here's the code (in the window controller) I use to do this: > > - (void) orderOutMyWindow: (id) sender { > NSString* title = self.window.title; > [self.window orderOut: sender]; > [NSApp addWindowsItem: self.window title: title filename: NO]; > } > > - (BOOL) windowShouldClose: (id) sender { > [self performSelector: @selector (orderOutMyWindow:) withObject: > sender afterDelay: 0.0]; > return NO; > } Thanks! Why is it necessary to delay the orderOutMyWindow invocation with performSelector? _______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com