Re: Stop NSSplitView from resizing with Window?
Re: Stop NSSplitView from resizing with Window?
- Subject: Re: Stop NSSplitView from resizing with Window?
- From: Brian Amerige <email@hidden>
- Date: Fri, 13 Oct 2006 16:18:08 -0400
- Resent-date: Fri, 13 Oct 2006 16:21:28 -0400
- Resent-from: Brian Amerige <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: email@hidden
Hi all,
I changed the method Conor Dearden gave me a bit ago, and it fixes a
few things problems I had with it. Please note I've not tested it
with anything other than my configuration, which is with a 1 pixel
thickness vertical splitview.
For one, it dynamically figures out the thickness of the divider so
it's not hard-coded.
For two, to allow for the scrollbar to be fully displayed properly,
it adjusts the left view properly.
For three, after resizing the window, if the window loses focus
(say, clicking into another app), the splitView divider doesn't
disappear, as it only calls "adjustSubviews" on the first launch.
int x=0;
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:
(NSSize)oldSize
{
x++;
//detect if it's a window resize
if ([sender inLiveResize])
{
//info needed
NSRect tmpRect = [sender bounds];
NSArray *subviews = [sender subviews];
NSView *collectionsSide = [subviews objectAtIndex:0];
NSView *tableSide = [subviews objectAtIndex:1];
float colllectionWidth = [collectionsSide bounds].size.width;
//tableside frame: full size minus collection width and divider
// My divider thickness is hard coded here as 1
tmpRect.size.width = tmpRect.size.width - colllectionWidth +
([sender dividerThickness]-[sender dividerThickness]);
tmpRect.origin.x = tmpRect.origin.x + colllectionWidth +
[sender dividerThickness];
[tableSide setFrame:tmpRect];
//collection frame stays the same
tmpRect.size.width = colllectionWidth;
tmpRect.origin.x = 0;
[collectionsSide setFrame:tmpRect];
}
else if (x==1)
{
[sender adjustSubviews];
}
}
Brian Amerige
http://extendmac.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden