Hi, I'm having some problems with an open panel. I display the panel, allow the user to chose and image, and then do some work, which involves showing a sheet while the work is done. This all works wonderfully, until the user clicks the "set texture" button again, and my method is called again. The second time, for some reason, the open panel is never displayed.
Can anyone tell what's going on here? I've added code below: - (IBAction)setTexture:(id)sender{ NSOpenPanel <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSOpenPanel.html> *panel = [NSOpenPanel <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSOpenPanel.html> openPanel]; [panel setCanChooseFiles:YES]; [panel setCanChooseDirectories:NO]; [panel setResolvesAliases:YES]; [panel setAllowsMultipleSelection:NO]; [panel setTitle:@"Select Texture"]; [panel setAllowedFileTypes:[NSArray <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html> arrayWithObject:@"png"]]; [panel beginSheetModalForWindow:[delegate windowForSheet] completionHandler:^(NSInteger result) { if (result == NSFileHandlingPanelOKButton) { NSURL <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSURL.html> *selection = [[panel URLs] objectAtIndex:0]; NSImage <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSImage.html> *image = [[[NSImage <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSImage.html> alloc] initWithContentsOfURL:selection] autorelease]; [self.item addObserver:self forKeyPath:@"textureIsCompressed" options:NSKeyValueObservingOptionNew context:nil]; self.item.texture = image; [panel close]; [NSApp beginSheet:compressingTexturePanel modalForWindow:[delegate windowForSheet] modalDelegate:self didEndSelector:@selector(compressionSheetDidEnd:) contextInfo:nil]; [compressingProgress startAnimation:self]; } }];} Thanks Tom Davie _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com