0

I got a dialog instead of sheet.It worked when the app was not document-based. Now it doesn't work.

    - (IBAction) showSheet:(NSWindow*)window
{
    // User has asked to see the dialog. Display it.
    NSLog(@"%@", self.contragentsSheet);
    if (!_contragentsSheet)
        [NSBundle loadNibNamed: @"contragentsSheet" owner: self];
    [NSApp beginSheet:self.contragentsSheet
       modalForWindow: [[NSApp delegate]window]
       //modalForWindow: window
        modalDelegate: self
       didEndSelector: NULL
          contextInfo: NULL];
    //[contragentSearch becomeFirstResponder];
    //NSLog ( @"Sheet is launched");
    NSLog(@"%@", [[NSApp delegate]window]);


}
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
user2414590
  • 123
  • 1
  • 7

1 Answers1

0

Don't use [[NSApp delegate] window] you need to explicitly tell the method which window you want to display the sheet on. Document based Apps can have many windows and a sheet is attached to one.

d00dle
  • 1,276
  • 1
  • 20
  • 33