• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Close button vs. command-h
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Close button vs. command-h
      • From: Andreas Mayer <email@hidden>
References: 
 >Close button vs. command-h (From: Ryan Homer <email@hidden>)
 >Re: Close button vs. command-h (From: Murat Konar <email@hidden>)
 >Re: Close button vs. command-h (From: Ryan Homer <email@hidden>)
 >Re: Close button vs. command-h (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: Close button vs. command-h
  • Next by Date: NSArrayController and variable number of NSTextFields
  • Previous by thread: Re: Close button vs. command-h
  • Next by thread: Re: Close button vs. command-h
  • Index(es):
    • Date
    • Thread