• 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: Opening a closed window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening a closed window


  • Subject: Re: Opening a closed window
  • From: "Stephen Deken" <email@hidden>
  • Date: Mon, 13 Nov 2006 10:57:03 -0600

On 11/13/06, z <email@hidden> wrote:
- (BOOL)applicationShouldHandleReopen: (NSApplication *)theApplication hasVisibleWindows: (BOOL)flag {
        [ [NSApp mainWindow] makeKeyAndOrderFront: nil];
        return YES;
}

By definition, a closed window cannot be main. An application's main window is the window that has the focus -- which is usually also the key window and the front window, but this does not have to be the case. You will find that your [NSApp mainWindow] call returns nil if the window has been closed.

Since your MyWindowController instance is your app's delegate, and (I
presume) that window controller has its -window outlet connected to
the window you want to display, try this:

-(BOOL) applicationShouldHandleReopen:(NSApplication*)theApp
hasVisibleWindows:(BOOL)v
{
    [[self window] makeKeyAndOrderFront:nil];
    return YES;
}

Stephen Deken
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Opening a closed window
      • From: Shawn Erickson <email@hidden>
References: 
 >Opening a closed window (From: "z" <email@hidden>)

  • Prev by Date: Re: Re: Bounds questions
  • Next by Date: Re: Opening a closed window
  • Previous by thread: Opening a closed window
  • Next by thread: Re: Opening a closed window
  • Index(es):
    • Date
    • Thread