NSOpenPanel instantly closing
NSOpenPanel instantly closing
- Subject: NSOpenPanel instantly closing
- From: Nick Forge <email@hidden>
- Date: Sun, 18 Feb 2007 14:30:41 +1100
I'm working through the cocoa-bible (Hillegass 2nd edition), and I'm
doing the first exercise that makes use of NSOpenPanel (pg 241).
Whenever I actually bring up the Open panel, it pops up, then almost
instantly closes again, leaving the application hanging. Here is my
code - I have re-written it twice to make sure I don't have any typos
or anything like that. I do not understand what would be killing the
panel before I even press anything... surely if I made some mistake
it would either not come up in the first place, or it would die when
I closed the panel?
- (IBAction)open:(id)sender
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
// Run the open panel
[panel beginSheetForDirectory:nil
file:nil
types:[NSImage imageFileTypes]
modalForWindow:[stretchView window]
modalDelegate:self
didEndSelector:
@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
Any ideas as to what might be causing it? I have put breakpoints both
before and after the beginSheetForDirectory call, but that doesn't
really help since it seems to screw up while executing that line.
Thanks,
Nick
_______________________________________________
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