Re: Opening a closed window
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