Question

I want to display a window as a sheet, which is perfectly running with the following code:

[NSApp beginSheet:mySheet
   modalForWindow:myWindow
    modalDelegate:nil 
   didEndSelector:NULL
      contextInfo:NULL];

However, there is ONE LITTLE PROBLEM:

  • I'm using an implementation of Chromium Tabs, and - for some reason probably related to the inner logic of Chromium Tabs - the sheet seems to appear somewhat LOWER than where I'd want it to be... (Perhaps that's what is considered as the window "border", but anyway...)

enter image description here

What's wrong? How could I fix that?

Was it helpful?

Solution

Just found it :

In the window's delegate, we implement window:willPositionSheet:usingRect: like this

- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet 
       usingRect:(NSRect)rect 
{
    rect.origin.y += 11;  // or as much as we need
    return rect;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top