Re: How to toggle the subviews of a split view?
Re: How to toggle the subviews of a split view?
- Subject: Re: How to toggle the subviews of a split view?
- From: Jacob Engstrand <email@hidden>
- Date: Sat, 14 Dec 2002 17:25:10 +0100
On lvrdag, dec 14, 2002, at 15:38 Europe/Stockholm, John Clayton wrote:
From what you're saying, I realize that adjustSubviews is doing some
proportional calculations that are overriding the width I have set the
subview's frame to. But then you suggest
to set the frame sizes _exactly_ right, so the hights of the frames
and the divider together fill the entire height of the BSSplitView
and this is where I get a little fuzzy. I know I can use the
NSSplitView delegate method splitView:resizeSubviewsWithOldSize: to
get at the frame sizes manually and block adjustSubviews from being
called. Should I be doing all my own frame resizing and never call
-adjustSubviews?
Hi,
This is what I mean (assuming a horizontal divider):
1. Find a good and cozy place in your code where you are sure that the
NSSplitView will not be resized by its parent view. (In my case, this
is just before I display the window with the NSSplitView in it, after
resizeing the window and its contents.)
2. Pick one of the two childviews. (In my case, I pick the top view.)
3. Set the frame of the top child view.
4. Now, take the hight of the NSSplitView, subtract the height of the
top child view that you just set. Also subtract the height of the
divider (call -dividerThickness).
5. Now you will have the height that's available for the bottom child
view. Set its frame to that height.
6. Call -adjustSubviews to make the NSSplitView update the position of
the divider. (Maybe you'll need to call [mySplitView -setNeedsDisplay:
YES] too.) If the heights of top view + divider + bottom view == height
of NSSplitView, the top and bottom views should not change their sizes
when you call -adjustSubviews.
Now, As long as the hight of the NSSplitView stays the same, the child
views will not change their sizes.
Regarding your question on -splitView:resizeSubviewsWithOldSize:, I
don't implement that in my app, so I can't describe the steps you need
to take to make that work, but from the docs it seems pretty straight
forward.
Hope this helps!
/jak
_________________________________________________________
Magician. Have rabbit. Will travel.
_______________________________________________
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.