Re: Sheet in a non-document-based Application
Re: Sheet in a non-document-based Application
- Subject: Re: Sheet in a non-document-based Application
- From: Mike Abdullah <email@hidden>
- Date: Sun, 12 Mar 2006 17:02:44 +0000
When in the start up process are you actually trying to start the
sheet? Some things don't work in the init methods, and I think this
is one of them.
Mike.
On 12 Mar 2006, at 16:41, Torsten Trautwein wrote:
Thanks you. That helped a lot, but I'm not done with it..
I'd like to show up the sheet right after the main Window has loaded.
I don't know why, but even though the code seems to be ok, the sheet
does not come up. I also tried to show it with a button just for
testing, but
that also doesn't work.
The according header source:
@interface AppController : NSObject
{
IBOutlet NSWindow *mainMenu;
IBOutlet NSWindow *mySheet;
}
- (IBAction)showSheet: (id)sender;
- (void)showMySheet: (NSWindow *)window;
- (IBAction)closeMySheet: (id)sender;
The according application source:
- (IBAction)showSheet: (id)sender
{
[self showMySheet:mainMenu];
}
- (void)showMySheet: (NSWindow *)window
{
if (!mySheet)
[NSBundle loadNibNamed: @"MySheet" owner: self];
[NSApp beginSheet: mySheet
modalForWindow: window
modalDelegate: nil
didEndSelector: nil
contextInfo: nil];
[NSApp runModalForWindow: mySheet];
[NSApp endSheet: mySheet];
[mySheet orderOut: self];
}
- (IBAction)closeMySheet: (id)sender
{
[NSApp stopModal];
}
When I click on the button, I do only get the following message in
the log:
2006-03-12 17:39:06.328 SheetApp[8019] *** Assertion failure in -
[NSApplication
_commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEn
dSelector:contextInfo:], AppKit.subproj/NSApplication.m:3057
2006-03-12 17:39:06.330 Sheet[8019] Modal session requires modal
window
Any idea what I do wrong?
Thanks,
Torsten Trautwein
On Mar 12, 2006, at 11:20 AM, Mike Abdullah wrote:
The problem is how you're actually showing the sheet, you want to
use NSApp's beginSheet method instead.
Mike.
_______________________________________________
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