Re: NSDocument beginSheet on a new document
Re: NSDocument beginSheet on a new document
- Subject: Re: NSDocument beginSheet on a new document
- From: Tod Cunningham <email@hidden>
- Date: Mon, 22 Nov 2004 12:36:49 -0500
I also found an example that suggested the following:
[[NSRunLoop currentRunLoop]
performSelector:@selector(editCabrilloHeadersForWindow:)
target:self
argument:[windowController
window]
order:0
modes:[NSArray
arrayWithObject:NSDefaultRunLoopMode]];
Is it recommend that I go through the runloop or should I just
performSelector on itself with a delay of 0?
On Nov 22, 2004, at 2:19 AM, Shaun Wexler wrote:
On Nov 21, 2004, at 9:50 PM, Tod Cunningham wrote:
I would like to have a sheet auto open when a new document is created
in an NSDocument project. Where is the best place to put the call to
beginSheet? I have tried several places and none seem to work. Most
interestingly the following doesn't work:
- (void)windowControllerDidLoadNib:(NSWindowController *)
windowController
{
...
if( some_condition_that_requires_sheet_to_be_auto_opened )
{
[NSApp beginSheet:cabrilloHeaderPanel
modalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(editCabrilloHeadersDidEnd:returnCode:
contextInfo:)
contextInfo:nil];
}
}
What happens is that the sheet gets opened, but not attached to the
window (looks very odd as the sheet will have to title bar). The
sheet opens before the window is visible and ends up detached. Any
ideas on how to approach this?
- (void)windowControllerDidLoadNib:(NSWindowController *)
windowController
{
...
if( some_condition_that_requires_sheet_to_be_auto_opened )
{
[self performSelector:@selector(openCHPSheet:)
withObject:[windowController window] afterDelay:0.0];
}
}
- (void)openCabrilloHeaderPanelSheetInWindow:(NSWindow *)window
{
[NSApp beginSheet:cabrilloHeaderPanel
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(editCabrilloHeadersDidEnd:returnCode:
contextInfo:)
contextInfo:nil];
}
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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