Re: Trouble with sheets...
Re: Trouble with sheets...
- Subject: Re: Trouble with sheets...
- From: Bruce Beerbower <email@hidden>
- Date: Sun, 18 Jun 2006 08:05:05 -0400
On Jun 17, 2006, at 8:20 PM, Sherm Pendley wrote:
On Jun 17, 2006, at 8: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...
One of these things is not like the others...
I'm sorry, that is was a problem with my e-mail, not with my actual
code. Here is what it should have been:
#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:nil];
}
- (IBAction)closeSheet(id)sender
{
[NSApp endSheet:thePanel];
}
@end
After a quick review of the conceptual docs for sheets, I don't see
anything that indicates that the didEnd selector might be optional
- passing nil could be the problem.
I'm fairly certain it is optional. Here's an excerpt from the
documentation for NSApplication:
...
The didEndSelector method is optional. If implemented by the
modalDelegate, this method is invoked after the modal session has
ended and is passed a return code and caller specified in contextInfo.
...
The example in Hillegass' book also sends an -orderOut: to the
sheet. This seems to work for me.
I'll try that later today (I'm busy this morning) and post my
results. (=
_______________________________________________
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