Re: Toolbar in a Sheet?
Re: Toolbar in a Sheet?
- Subject: Re: Toolbar in a Sheet?
- From: Matt Ball <email@hidden>
- Date: Mon, 24 May 2004 23:49:33 -0400
Dang! As soon as I sent the email I fixed #1. For anyone who wants to
know, I changed my code to:
- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet
usingRect:(NSRect)rect {
if([[sheet title] isEqualTo: @"Shape"])
{
NSRect windowFrame = [mainWindow frame];
NSRect sheetFrame = [sheet frame];
int halfOfWidth = windowFrame.size.width/2;
int halfOfSheetWidth = sheetFrame.size.width/2;
NSRect fieldRect = NSMakeRect(halfOfWidth - halfOfSheetWidth,
windowFrame.size.height, sheetFrame.size.width, 0);
return fieldRect;
}
}
And yes, I know that my function doesn't return anything if the sheet
isn't called "Shapes." I'm going to go back and add an else statement
in a few minutes. Anyway, I only need #2 and #3 resolved now.
-- Matt Ball
On May 24, 2004, at 11:32 PM, Matt Ball wrote:
>
I want to put a toolbar in a sheet (ala iMovie's "share" sheet,
>
although iMovie uses a fake toolbar). Everything works fine, except
>
the sheet is drawn about 20 pixels below where it should be.
>
Apparently, because of the toolbar, transparent space is being drawn
>
where the titlebar should be. I've experimented and so far, I've come
>
up with this, which is in my MyDocument.m file:
>
>
- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow
>
*)sheet usingRect:(NSRect)rect {
>
if([[sheet title] isEqualTo: @"Shape"])
>
{
>
NSRect windowFrame = [mainWindow frame];
>
int halfOfWidth = windowFrame.size.width/2;
>
NSRect fieldRect = NSMakeRect(windowFrame.size.width - halfOfWidth,
>
windowFrame.size.height, 0, 0);
>
>
return fieldRect;
>
}
>
}
>
>
This works except for a few minor problems. First, the sheet appears
>
(using a genie effect) from the top center of the titlebar instead of
>
the bottom center of it. After it is animated, the sheet is in the
>
right place, but during the animation, it originates from the wrong
>
place. Secondly, during the animation, shadows are drawn on the edges
>
of the transparent space where the titlebar should be. The shadows
>
disappear as soon as the sheet finishes animating.
>
>
Does anyone have any ideas on how I might:
>
>
1) Force the sheet to slide down instead of using the genie effect
>
(the sheet IS smaller than the window, so it should slide)
>
2) Make the sheet originate from the correct position
>
3) Get rid of the nonexistent titlebar's shadows during the animation
>
>
Thanks in advance,
>
-- Matt Ball
_______________________________________________
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.