Dale,

I believe the recipe you want involves shoe-horning the scrollViewRect into its 
containing window.

For an example, look at the DocumentWindowController's resizeWindowForViewSize 
method in TextEdit (shown below).

HTH,
Joel


- (void)resizeWindowForViewSize:(NSSize)size
{
    NSWindow *window = [self window];
    NSRect origWindowFrame = [window frame];
    if (![[self document] hasMultiplePages])
    {
        size.width += (defaultTextPadding() * 2.0);
    }
    NSRect scrollViewRect = [[window contentView] frame];
    scrollViewRect.size = [[scrollView class] frameSizeForContentSize:size 
                          hasHorizontalScroller:[scrollView 
hasHorizontalScroller] 
                          hasVerticalScroller:[scrollView hasVerticalScroller] 
                          borderType:[scrollView borderType]];
    NSRect newFrame = [window frameRectForContentRect:scrollViewRect];
    newFrame.origin = NSMakePoint(origWindowFrame.origin.x, 
                                  NSMaxY(origWindowFrame) - 
newFrame.size.height);
    [window setFrame:newFrame display:YES];
}



      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to