Skip navigation.
 
mlSheet Doesn't Attach Itself To Window
FROM : Brian T. Kelley
DATE : Wed Nov 28 20:53:37 2007

Hello,

I'm trying to display a sheet in Leopard but I've run into a peculiar 
situation, for which I cannot find anyone who has shared a similar 
experience. I can display a sheet but it is not attached to the 
window. When the sheet appears (i.e. it just shows up, no animation) 
it is properly centered on its window. I can click on the title bar of 
the owner window and move that window around but the sheet remains in 
its original location. If anyone could advise me on how to correct the 
problem, I'd greatly appreciate it.

I call NSApp's 
beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: 
method. I've verified that no nil values, other than contextInfo are 
being passed to the method. The code that displays the sheet is as 
follows:

[NSApp beginSheet:self.sheetWindowController.window
  modalForWindow:self.window
    modalDelegate:self
    didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
      contextInfo:nil];
[NSApp runModalForWindow:self.sheetWindowController.window];

The sheetWindowController property's body is as follows. Note that 
sheetWindowController is an instance variable.

if (sheetWindowController == nil)
{
   sheetWindowController = [[SheetWindowController alloc] init];
   
   if (editStudentWindowController == nil)
   {
       NSLog(@"Failed to load the nib file \"TheSheet\"");
   }
}

return editStudentWindowController;

The init method for SheetWindowController loads the nib file with the 
following code:

- (id)init
{
   if ((self = [super initWithWindowNibName:@"TheSheet"]))
   {
       // TODO: Add code once this starts working!
   }
   
   return self;
}

The nib files seem to be wired up properly and the code seems to load 
everything properly as the sheet does actually appear, just not 
attached to the window.

If someone could point out my error or advise me to more advanced 
debugging techniques to find the error, I would greatly appreciate it.

Thanks in advance,
Brian

Related mailsAuthorDate
mlSheet Doesn't Attach Itself To Window Brian T. Kelley Nov 28, 20:53
mlRe: Sheet Doesn't Attach Itself To Window PGM Nov 28, 21:30
mlRe: Sheet Doesn't Attach Itself To Window Brian T. Kelley Nov 28, 21:38
mlRe: Sheet Doesn't Attach Itself To Window PGM Nov 28, 21:49
mlRe: Sheet Doesn't Attach Itself To Window Brian T. Kelley Nov 28, 21:52
mlRe: Sheet Doesn't Attach Itself To Window Brian T. Kelley Nov 28, 22:16