Re: NSOpenPanel instantly closing
Re: NSOpenPanel instantly closing
- Subject: Re: NSOpenPanel instantly closing
- From: email@hidden
- Date: Sat, 17 Feb 2007 23:11:30 -0700
I just copied and pasted your code into another application, and it
works fine for me.
I had a previously linked unused IBAction method in a window
controller subclass that I pasted it into. I replaced [stretchView
window] with [self window].
No problem here. It even called a pre existing OpenPanelDidEnd method.
On Feb 17, 2007, at 8:30 PM, Nick Forge wrote:
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
_______________________________________________
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