• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: willPositionSheet never called ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: willPositionSheet never called ??


  • Subject: Re: willPositionSheet never called ??
  • From: Matt Ball <email@hidden>
  • Date: Tue, 1 Jun 2004 15:47:36 -0400

The following code works for me in MyDocument.m:

- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet
usingRect:(NSRect)rect {

if([[sheet title] isEqualTo: @"Shape"])
{
NSRect fieldRect;
NSRect windowFrame = [mainWindow frame];
NSRect sheetFrame = [sheet frame];
int halfOfWidth = windowFrame.size.width/2;
int halfOfSheetWidth = sheetFrame.size.width/2;
fieldRect = NSMakeRect(halfOfWidth - halfOfSheetWidth,
windowFrame.size.height, sheetFrame.size.width, 0);
return fieldRect;
}
return rect;
}

FYI, that code moves the sheet up 20 pixels to fix a bug using Toolbars
in Sheets.

Did you maybe forget to return your rect at the end of the function?

-- Matt Ball
On Jun 1, 2004, at 7:49 AM, Jirome Foucher wrote:

> Hi list !
>
> Is it just me or is the following delegate method introduced in 10.3 :
> - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow
> *)sheet usingRect:(NSRect)rect;
>
> never called ??
>
> As I understand it, this method should be called before a sheet is
> being displayed.
> The doc
> (http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/
> Tasks/PositioningSheets.html) just states that I should add that
> method to the window's delegate, which is what I did. I tried to add
> this method into the NSWindow's subclass definition as well, but to no
> avail.....
>
> FYI, my NSWindow's subclass displays sheets using [NSApp
> beginSheet....]. Do I have to add anything special to my NSWindow's
> subclass, or anything else ?
>
> Thanks
> Jerome
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: willPositionSheet never called ??
      • From: Jérome Foucher <email@hidden>
References: 
 >willPositionSheet never called ?? (From: Jérome Foucher <email@hidden>)

  • Prev by Date: Re: Code Guidelines
  • Next by Date: NSMenu and RunLoop?
  • Previous by thread: willPositionSheet never called ??
  • Next by thread: Re: willPositionSheet never called ??
  • Index(es):
    • Date
    • Thread