Fwd: Modal sheet
Fwd: Modal sheet
- Subject: Fwd: Modal sheet
- From: Hamish Allan <email@hidden>
- Date: Fri, 11 Mar 2005 04:19:26 +0000
Sorry, it turns out that progressSheet was nil (I could have sworn I already checked for that).
I don't understand why it's nil, though. I instantiated my controller in IB and connected it all up so that my controller's outlets include progressSheet with a destination of NSWindow (Processing) where 'Processing' is the name of my sheet's window in the NIB. Pressing buttons on the main window triggers methods in my controller where those connections were made in IB, but none of the outlets from either the document window or the sheet window are available (i.e., they are nil).
I'm starting to feel like I really don't understand as much as I thought I did. Could somebody please offer some advice (other than "get some sleep")?
Thanks,
Hamish
Begin forwarded message:
From: Hamish Allan <email@hidden>
Date: March 11, 2005 3:32:27 GMT
To: Cocoa List <email@hidden>
Subject: Modal sheet
Hi,
I'm getting the following errors trying to open a modal sheet:
2005-03-11 03:03:52.747 BeatLabel[10216] startProgress: Metanome: etco Prelude 1.mp3
2005-03-11 03:03:52.774 BeatLabel[10216] *** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], AppKit.subproj/NSApplication.m:2763
2005-03-11 03:03:52.805 BeatLabel[10216] *** NSRunLoop ignoring exception 'NSInternalInconsistencyException' (reason 'Modal session requires modal window') that raised during posting of delayed perform with target 387e40 and selector 'startDecoding:'
What I'm trying to do is make a sheet to pop up on a document's window immediately after it first appears (to indicate progress decoding MP3 data into PCM). Therefore I have in my document class:
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type
{
myFileData = [data retain];
[self performSelector:@selector(startDecoding:)
withObject:type afterDelay:0];
return YES;
}
- (void)startDecoding:(id)userData
{
[myWindowController startProgress:
[@"Decoding " stringByAppendingString: (NSString *)userData]];
[NSThread detachNewThreadSelector: @selector(doDecoding:)
toTarget:self withObject:userData];
}
[...]
and in my controller class:
- (void)startProgress:(NSString *)message
{
NSLog(@"startProgress: %@", [[self window] title]);
[progressSheetInfo setStringValue: message];
myCancelProgressFlag = FALSE;
[progressSheetBar setIndeterminate:YES];
[progressSheetBar startAnimation:self];
[NSApp beginSheet:progressSheet
modalForWindow:[self window]
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
NSLog(@"End startProgress");
}
As evidenced by the log, the controller's window outlet has been set up correctly. What else might I be missing?
Thanks,
Hamish
_______________________________________________
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