Re: Trouble with NSSplitView
Re: Trouble with NSSplitView
- Subject: Re: Trouble with NSSplitView
- From: Jonathan Hess <email@hidden>
- Date: Wed, 8 Oct 2008 12:05:34 -0700
On Oct 8, 2008, at 4:59 AM, Dave Fernandes wrote:
Hi Jon,
Given your explanation, I now don't understand why my split view
works at all. I can resize my views to zero and back up again
without having to jump to zero after reaching the minimum size.
Another question: what does Mail do when it jumps to zero? Does it
remove the subview from the split view?
Hey Dave -
The split view keeps the collapsed view's bounds from ever reaching
size zero. The documentation for the split view delegate covers, this.
There are also great comments in the header for NSSplitView.h.
The relevant delegate methods are:
- [NSObject splitView:canCollapseSubview:];
- [NSObject splitView:constrainMinCoordinate:ofSubviewAt:];
- [NSObject splitView:constrainMaxCoordinate:ofSubviewAt:];
Here's a link to the relevant split view docs:
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSplitView_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/splitView:canCollapseSubview:
Good Luck -
Jon Hess
Dave
On Oct 7, 2008, at 10:43 PM, Jonathan Hess wrote:
On Oct 7, 2008, at 4:44 PM, Dave Fernandes wrote:
I had the same problem. The fix was to recreate the view in IB.
Seems to be a bug in IB, but I never tried to repeat the problem
once it was fixed.
This isn't a problem with IB, it also isn't unique to split views.
The problem has to do with how the autoresizing rules used by
NSView are applied. They're applied as scaled deltas from previous
values, and when you fully collapse a split view, you have a view
size that goes to zero, and all of the scaling then clamps to zero
(zero times anything is zero).
To deal with this, this you should use the NSSplitView delegate
methods to prevent the view from getting smaller than some minimum
size. The typical behavior is to have the split view resizing
towards the minimum, when it gets to that minimum it stops resizing
even as the user continues to drag the mouse. Once the user drags
the mouse all of the way, the view completely collapses. Behind the
scenes, NSSplitView doesn't make the subview any smaller than the
minimum size, but that isn't evident to the user.
You can see this behavior in Mail. Open a Mail window, and then
drag the split bar that splits the messages table and the message
composition view. When the split bar gets to about 100 points from
the bottom of the window it stops moving. If you keep dragging, the
splitter eventual jumps the remaining distance.
Jon Hess
Dave
On Oct 7, 2008, at 5:41 PM, Andre Masse wrote:
Hi,
I have set up in IB a window with 3 split views. The main split
view (with a vertical divider) contains 2 splits (horizontal
divider):
**************************************
* * 3 *
* 1 ********************************
* * *
* * *
******* 4 *
* * *
* 2 * *
**************************************
I'm using an NSViewController subclass (with an associated nib)
for each of the views. In the - windowDidLoad: method of my
NSWindowController subclass, I set dividers positions and add
each view, resizing it according to the size available in each
pane. I'm testing this interface so all views contain dummy
controls:
1- has only buttons
2- has only a Date picker in calendar form
3- has a multiline text view (with scroller) and 2 buttons.
4- has a NSTableView
At launch, everything is good and I've no problem changing the
splitter's position between pane 1 and 2 or with the vertical
divider. Now, if I change the splitter's position between pane 3
and 4 all the way up or down and back, the header of the
NSTableView and the top of the text view, become hidden (under
the divider). I've tried many combinations of resize/lock for
these views in IB, played various constants with -
setAutoresizingMask:. No luck. Either I'm missing the good one,
or I'm in the wrong track. This is driving me nuts, any advice on
getting the good combination?
Thanks,
Andre Masse
_______________________________________________
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
_______________________________________________
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