I'm trying to create a custom modal window and here is the code I have so far:
NSWindowController *modalSheet = [[NSWindowController alloc]
initWithWindowNibName:@"MyCustomWindow" owner:self];
[NSApp beginSheet:[modalSheet window]
modalForWindow:[self windowForSheet]
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
The window pops up fine but it's not modal e.g. you can still do things to the parent window where the requests come from. This method is called from an NSDocument object.
I've tried to read: Using Custom Sheets
However i'm not sure what myCustomSheet
is as it's not declared anywhere. I assume it's an NSWindow
instance variable.
I just can't understand why it's not modal. Any help would be much appreciated. Thanks