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: Andy Lee <email@hidden>
- Date: Sun, 22 Sep 2002 22:19:38 -0400
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.