Re: Any way to keep on pane of NSSplitView from resizing?
Re: Any way to keep on pane of NSSplitView from resizing?
- Subject: Re: Any way to keep on pane of NSSplitView from resizing?
- From: Rick Mann <email@hidden>
- Date: Mon, 28 Dec 2009 08:28:34 -0800
Thanks, that's exactly what I did. Not quite as easy as checking a box
in IV, but easy enough.
Sent from my iPhone
On Dec 28, 2009, at 8:21, Ken Ferry <email@hidden> wrote:
This is much easier in 10.6 and later. From the AppKit release notes:
New NSSplitView delegate method (New since January 2009 seed)
To make it easier for your application to maintain the size of given
subviews of a split view while the split view is being resized,
NSSplitView in Mac OS 10.6 has a new -
splitView:shouldAdjustSizeOfSubview: delegate method you can
implement. It controls how -adjustSubviews behaves so you don't have
to rewrite so much of its default behavior in a -
splitView:resizeSubviewsWithOldSize: delegate method.
By returning NO from this method, you can lock the size of a split
view subview while the split view is resized. However, if the split
view shrinks beyond the point that all of the resizable subviews are
completely hidden, the subviews you returned NO for will start
resizing as well to prevent -adjustSubviews from creating an invalid
subview layout.
-Ken
On Mon, Dec 28, 2009 at 5:14 AM, Gustavo Pizano <email@hidden
> wrote:
Its not so complicated as it look...
I was having problems also with that... but then I found somewhere
on internet how they do it... but they were taking more things into
account... I just needed to do what you want.
just declare the Max and min width/height of your left/top view,
implement the delegate methods :
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:
(CGFloat)proposedMaxofSubviewAt:(NSInteger)dividerIndex
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:
(CGFloat)proposedMinofSubviewAt:(NSInteger)dividerIndex
to return tohse values.
then implement:
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:
(NSSize)oldSize
and there check for:
the new size of the sender (splitView)
take the right and left sizes (top/bottom)
get the divider thickness
modify only the right/bottom size width/height and leave the the
left/top width/height to be the new frame size.width /size.height
(which you got from splitView parameter).
set the new frames to left and right or top/bottom...
if you make some miscalculation you will get a message in console
saying something that the splitview its being redisplayed and
recalculated sizes at the cost of performance... if you get that
when resizing the window(view) that contains the splitview then you
know you did something wrong... if you don't get it.. then all was
ok.
I hope it helps.. Im not expert in cocoa yet.. but this works for me.
G.
On Dec 28, 2009, at 2:30 AM, Rick Mann wrote:
>
> On Dec 27, 2009, at 17:09:18, Andrew Farmer wrote:
>
>> On 27 Dec 2009, at 16:41, Rick Mann wrote:
>>> I have an NSSplitView that divides my window in to two panes
(vertically). When the window is resized, I'd like the left pane to
keep the width it has, rather than having both panes resizing
proportionally. Is this possible?
>>
>> Sure. Even without getting BWToolkit involved, a split view
delegate can control what goes where when the view gets resized.
>
> I keep looking for a setting in IB for such things, and don't
think to look for a delegate. Bit of a PITA, but it'll do. Thanks!
>
> --
> Rick
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden