Re: -beginSheet:modalForWindow:modalDelegate:didEndSelector
Re: -beginSheet:modalForWindow:modalDelegate:didEndSelector
- Subject: Re: -beginSheet:modalForWindow:modalDelegate:didEndSelector
- From: Steve Mills <email@hidden>
- Date: Fri, 20 Feb 2015 14:51:39 -0600
On Feb 20, 2015, at 14:34:29, Raglan T. Tiger <email@hidden> wrote:
>
> 2015-02-20 13:17:57.666 [5613:177188] aboutWindowController <ETAboutWindowController: 0x6000000e4600>
> 2015-02-20 13:17:57.666 [5613:177188] aboutWindowController window <NSWindow: 0x6000001e9500>
> 2015-02-20 13:17:57.666 [5613:177188] mainWindow window <NSWindow: 0x6000001e9500>
>
> You can see that as Steve asked the main window and sheet window are the same.
>
> So, I added an outlet of the app window and get:
>
> 2015-02-20 13:28:21.563 [5792:181060] aboutWindowController <ETAboutWindowController: 0x6100000e1b00>
> 2015-02-20 13:28:21.563 [5792:181060] aboutWindowController window <NSWindow: 0x6180001edb00>
> 2015-02-20 13:28:21.563 [5792:181060] appWindow <NSWindow: 0x6080001e0400>
>
> Which on its face looks good ... but the sheet still displays as a window with no title and does not slide down from the app window.
>
> ETAboutWindowController *aboutWindowController = [[ETAboutWindowController alloc] initWithWindowNibName:@"ETAboutWindowController"];
> NSWindow *aboutWindow = [aboutWindowController window];
>
> NSLog(@"aboutWindowController %@",aboutWindowController);
> NSLog(@"aboutWindowController window %@",aboutWindow);
> NSLog(@"appWindow %@",m_window);
>
> [NSApp beginSheet:aboutWindow modalForWindow:m_window modalDelegate:nil didEndSelector:nil contextInfo:nil];
>
> This just seems too ridiculous for something that has been around forever and that I have successfully implemented in the past.
Yes, I agree. It should be smart enough, for instance, to use a window regardless of whether or not it has a title bar. The only other suggestions I have is to make sure your xib's File Owner's class is ETAboutWindowController, and its window outlet it hooked up to the window. But I assume both of those are correct, otherwise we wouldn't be seeing that output.
Have you thought about trying the non-deprecated methods for displaying sheets, e.g. those in NSWindow? I'm using those for mine, but I'm targeting 10.9 and later.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden