views:

24

answers:

0

This ought to be very basic but after trying for an hour or so I can't figure out how to do this correctly:

I have a NSOutline view with two columns, of which the right one should always be fully visible. The enclosing NSScrollView is set to show a vertical scroller only. Now whenever the vertical scroller appears it covers part of the right column. What I would like to achieve however, is that the right column moves left so that it's still fully visible.

I've first tried fiddling with the resizing options in IB for a while but this didn't seem to do the trick.

I've then created a custom NSOutlineView with

-(void)viewWillDraw {
 CGRect contentFrame = [[[self enclosingScrollView] contentView] frame];
 CGRect ourFrame = self.frame;

 CGFloat correction = ourFrame.size.width - contentFrame.size.width;

 //resize the first column when the scrollbar appears 
 [[self outlineTableColumn] setWidth:kOutlineColumnWidth - correction];

 [super viewWillDraw];
}

Problem is, the function gets called several times when the scroller disappears and the column grows and shrinks a few times for some reason which is pretty ugly. Also when the window loses focus, the left column grows back to normal size causing the right column to be covered by the scroller again.