• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
modal sheet not understood
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

modal sheet not understood


  • Subject: modal sheet not understood
  • From: Hans van der Meer <email@hidden>
  • Date: Fri, 14 Mar 2008 17:16:17 +0100

I thought to implement an open panel on my main window and expected it to wait for the dismissal of the sheet. It seems that actually the events are out of the inendedorder. What is wrong with the following code? Why didn't it wait for the sheet being closed?

// Put up the sheet for and retrieve the return value.
	[panel beginSheetForDirectory:nil
		file:nil
		types:nil
		modalForWindow:aWindow
		modalDelegate:self
		didEndSelector:@selector(openSheetDidEnd:returnCode:contextInfo:)
		contextInfo:nil];

// If we have a file path the data will be read.
	NSLog(@"directly after beginSheetForDirectory");
	NSString *filePath = [[panel filenames] objectAtIndex:0];
	.....

- (void) openSheetDidEnd:(NSOpenPanel *)panel
		returnCode:(int)returnCode contextInfo:(void *)contextInfo; {
	NSLog(@"directly inside openSheetDidEnd");
	if (NSOKButton == returnCode)
		NSLog(@"chosen sheet %@", [[panel filenames] objectAtIndex:0]);
	else
		NSLog(@"sheet cancelled");
}

This called somewhere starting at ...ForWindow[NSApp mainWindow] -> aWindow

The output shows the wrong order of events:
2008-03-14 .. directly after beginSheetForDirectory
2008-03-14 .. *** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)
2008-03-14 .. directly inside openSheetDidEnd
2008-03-14 .. chosen sheet /Users/hans/Projects/Cocoa/Railfence/testdata


Hans van der Meer




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: modal sheet not understood
      • From: Stéphane <email@hidden>
    • Re: modal sheet not understood
      • From: "Rob Napier" <email@hidden>
  • Prev by Date: Re: Can core data save to a remote file?
  • Next by Date: Re: newb problem- Currency Converter app problem- Can't Add ConverterController Class to Nib
  • Previous by thread: Re: Mail - check email
  • Next by thread: Re: modal sheet not understood
  • Index(es):
    • Date
    • Thread