Overcoming crappiness of NSSplitView - what's the magic?
Overcoming crappiness of NSSplitView - what's the magic?
- Subject: Overcoming crappiness of NSSplitView - what's the magic?
- From: Graham Cox <email@hidden>
- Date: Wed, 16 Sep 2009 00:01:42 +1000
Ok, I'm beating my head on this one, wasting time I have better things
to spend it on. NSSplitView is a travesty, but we're stuck with it, so
I need to know the magic incantation of delegate methods and other
voodoo needed to implement the following for a split view with one
upper and one lower pane.
1. When I drag the splitter directly, it moves allowing me to position
it where I want within the constrained min and max of the contained
views.
2. When the window resizes I want the split to stay exactly where it
is relative to the top of the window. I do not want it to move
proportionally which seems to be the default. In other words the
window resize affects the bottom pane only, even though the top one
can be resized by the split. Whoever decided that was a sensible
behaviour for the default anyway?
3. When the window is resized programatically as well as drag-resized,
2. needs to be true also.
This seems so simple and obvious that I'm finding it very frustrating
that nothing I have tried works.
What I have tried:
- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:
(NSView *)subview
I've tried returning NO for the times when the window is being
resized, assuming that this would effectively lock the split in place.
It's not even called except once when the view is instantiated. I'm
guessing then that this is meant to indicate the general disposition
of view splitting, called just once for all time. The docs are unclear
on this to say the least.
- (CGFloat)splitView:(NSSplitView *)splitView constrainSplitPosition:
(CGFloat)proposedPosition ofSubviewAt:(NSInteger)dividerIndex
This is at only called during manual dragging, so can't be used to
constrain the split during window resize, as even though the split is
being moved at that time, this isn't checked. In any case there's no
way to obtain the current split position at the start of the window
resize so I can return it to effect a "lock".
- (void)splitViewWillResizeSubviews:(NSNotification *)aNotification
This is called in both cases - dragging the split and resizing the
window. But what can I do with it? Since there's no way to get the
split position at the start of a resize I can't set it from here or
anywhere else.
Any ideas what I can do?
--Graham
_______________________________________________
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