• 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
Open panel is permanently dead?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Open panel is permanently dead?


  • Subject: Open panel is permanently dead?
  • From: Tom Davie <email@hidden>
  • Date: Fri, 19 Feb 2010 14:17:58 +0000

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 (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: Open panel is permanently dead?
      • From: "Henry McGilton (Boulevardier)" <email@hidden>
  • Prev by Date: Re: Determine smallest height of vertical scrollbar
  • Next by Date: Re: Open panel is permanently dead?
  • Previous by thread: Minor resize trouble with NSScrollView
  • Next by thread: Re: Open panel is permanently dead?
  • Index(es):
    • Date
    • Thread