Re: [Q] Programmatically resizing split views in NSSplitView
Re: [Q] Programmatically resizing split views in NSSplitView
- Subject: Re: [Q] Programmatically resizing split views in NSSplitView
- From: Mark de Jong <email@hidden>
- Date: Sun, 22 Sep 2002 21:49:00 -0700
Thanks! That's got me going in the right direction.
(I was using "bound" and "setBounds:" instead of "frame" and
"setFrame:" ... oops! :-) )
-- Mark
On Sunday, September 22, 2002, at 07:19 PM, Andy Lee wrote:
At 6:50 PM -0700 9/22/02, Mark de Jong wrote:
I'm trying to programmatically resize a subview of NSplitView. While
I can find its subviews by calling the "subviews:" method; and I can
successfully resize a subview, the "divider" doesn't move and I can't
seem to find a way to make it move.
Here's the code I use for an NSSplitView with two subviews (code
slightly edited for public consumption):
// ...calculate NSRects newFrameOne and newFrameTwo...
[subviewOne setFrame:newFrameOne];
[subviewTwo setFrame: newFrameTwo];
[theSplitView adjustSubviews];
[theSplitView setNeedsDisplay:YES];
IIRC, you need to resize *all* subviews of the splitview, and in such
a way that their combined size stays the same.
You need to call -adjustSubviews. I think this tells the splitview to
recalculate where the divider should be drawn.
I think the -setNeedsDisplay: was needed to get the divider to redraw
properly. Without the call, the divider would draw in the right
place, but with cruft on it.
I based my code on discussions on this list (or maybe the other) from
a while back, so if the above doesn't work for you, you might try
searching the archives and/or looking deeper in the NSSplitView docs.
--Andy
_______________________________________________
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.
_______________________________________________
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.