簡単な方法はありません。ハックな方法は、ドキュメントのウィンドウとシートのウィンドウの両方に対して NSWindow のサブクラスを作成し、そのクラスで orderFront: と makeKeyWindow の両方をオーバーライドして、beginSheet を呼び出している間は何もしないようにすることです。例えば、
NSWindow サブクラスでは:
-(void)awakeFromNib
{
hack = NO;
}
-(void)hackOnHackOff:(BOOL)foo
{
hack = foo;
}
- (void)orderFront:(id)sender
{
if (!hack)
[super orderFront:sender];
}
- (void)makeKeyWindow
{
if (!hack)
[super makeKeyWindow];
}
そして、beginSheet 呼び出しは次のようになります。
-(void)sheet
{
SpecialSheetWindow* documentWindow = [self windowForSheet];
[documentWindow hackOnHackOff:YES];
[sheetWindow hackOnHackOff:YES];
[[NSApplication sharedApplication] beginSheet:sheetWindow
modalForWindow:documentWindow
modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
[documentWindow hackOnHackOff:NO];
[sheetWindow hackOnHackOff:NO];
}