Re: Progress Sheet on a NSDocument
Re: Progress Sheet on a NSDocument
- Subject: Re: Progress Sheet on a NSDocument
- From: James Bucanek <email@hidden>
- Date: Fri, 23 Mar 2007 18:01:01 -0700
Alan,
On the surface, what you appear to be doing looks correct. I do something very similar for long-running processes where the user can't use the document window. My sheets work exactly as you would expect.
I can only suggest that something else is wrong. How are you creating the NSPanel that's attached to the window? I load mine from a NIB. Is it the correct class and type? Is it retained? Is it correctly initialized? I've spent (read "wasted") many hours trying to diagnose window and NSView problems where I didn't correctly initialize objects using the designated initializer.
The only thing I note that different is that you don't use a delegate or didEndSelector. I suppose that should work, I've just never done it that way.
And you say that the panel is movable separate from the window? That's definitely wrong. I'd double and triple check every parameter that's getting passed to beginSheet:modelForWindow:...
James
Alan Smith wrote on Friday, March 23, 2007:
>I am having trouble with NSDocument and NSPanel working together.
>Here's the scoop:
>
>I want to have a "ProgressPanel" on my document as it does some
>intensive saving. I want the panel to appear as a sheet so as to stay
>out of the way.
>
>I've tried to do this with the code appended to this email but it's
>not quite working. The problem is that when the panel is displayed it
>pushes the document window it is attached to off-screen. This is
>totally uncalled for. But, this problem is gone if you save again, in
>the same way.
>
>I've tried running the panel as a modal in hopes that that would fix
>it but no, it didn't. I also made sure that the panel was not set to
>be a floating panel but that didn't fix it either. I've searched
>online extensively but have found nothing addressing this.
>
>Also, the document window can be moved separately from the panel and I
>would like that not to happen. They should move as one. One last
>thing, how does one get the sheet to "pull down" or, "slip out" from
>the top of the window? It doesn't appear to happen with
>beginSheet:::::.
>
>Many thanks, I eagerly await your replies.
>
>Peace, Alan
>
>[NSApp beginSheet: progressPanel modalForWindow: [self windowForSheet]
>modalDelegate: nil didEndSelector: nil contextInfo: nil];
>
>// Do stuff...
>
>[NSApp endSheet: progressPanel];
>[progressPanel orderOut: nil];
>
>
--
James Bucanek
_______________________________________________
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