Re: Close button vs. command-h
Re: Close button vs. command-h
- Subject: Re: Close button vs. command-h
- From: Ryan Homer <email@hidden>
- Date: Sat, 3 Feb 2007 09:01:30 -0500
Thanks Clark. The second part did it. I didn't even have to implement
the first part.
@implementation MyWindowDelegate
-(BOOL)windowShouldClose:(id)sender
{
if(sender == myMainWindow)
{
[myMainWindow orderOut: nil];
return NO;
}
return YES;
}
@end
I didn't have to implement the windowShouldClose as above which makes
me think that the close button performs an orderOut: by default and
doesn't destroy my window.
@implementation MyApplicationDelegate
-(BOOL)applicationShouldHandleReopen:(NSApplication*)application
hasVisibleWindows:(BOOL)visibleWindows
{
if(!visibleWindows)
{
[myMainWindow makeKeyAndOrderFront: nil];
}
return YES;
}
@end
Since this was able to bring the window back, it was just a matter of
intercepting the "click" and taking appropriate action. So, I have to
wonder what command-H does differently. Does it orderOut: and then
perhaps sets up some kind of notification in order to act on the
click and re-display the window?
Anyway, thanks to all for the responses and help.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden