• 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
Re: Trouble with sheets...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with sheets...


  • Subject: Re: Trouble with sheets...
  • From: Mike Kobb <email@hidden>
  • Date: Sun, 18 Jun 2006 20:57:05 -0700

As mentioned by another member, I do believe you need to tell the sheet to orderOut:

- (IBAction)closeSheet:(id)sender
{
    [NSApp endSheet:addPanel];
    [addPanel orderOut:self];
}

It's a bit confusing, since generally something like NSBeginAlertSheet doesn't require that you send the orderOut unless you need to bring up another sheet in response to the response to your alert. But, if you use the NSApp method of deploying the sheet, you do seem to need to also manually put it away.

I hope somebody will correct me if I'm wrong, but this is my understanding.

Best,
--Mike

On Jun 17, 2006, at 5:06 PM, Bruce Beerbower wrote:

I'm having trouble trying to display a panel as a sheet. I'v read through the Cocoa documentation and a book I have (Cocoa In A Nutshell) on this subject and this is (more or less) the code I have:

#import <Cocoa/Cocoa.h>

@interface SheetController : NSObject
{
    IBOutlet NSPanel *thePanel;
    IBOutlet NSWindow *mainWindow;
}

- (IBAction)openSheet:(id)sender; // Button action from mainWindow
- (IBAction)closeSheet:(id)sender; // Button action from thePanel

@end

@implementation SheetController

- (IBAction)openSheet:(id)sender
{
[NSApp beginSheet:thePanel
modalForWindow:mainWindow
modalDelegate:self // I think this might be the problem. What should it be?
didEndSelector:nil
contextInfo:NULL];
}


- (IBAction)closeSheet(id)sender
{
	[NSApp endSheet:addPanel];
}

@end

This compiles just fine but it doesn't seem to work; when I press the button which triggers openSheet the sheet opens properly, but when I press the button which triggers closeSheet it doesn't close. Dose anybody see what I'm doing wrong?



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Trouble with sheets... (From: Bruce Beerbower <email@hidden>)

  • Prev by Date: [ANN] BuildFactory 1.0 released
  • Next by Date: Re: NSTableView controlTextDidChange:
  • Previous by thread: Re: Trouble with sheets...
  • Next by thread: Re: Trouble with sheets...
  • Index(es):
    • Date
    • Thread