Re: SynchroScrollView
Re: SynchroScrollView
- Subject: Re: SynchroScrollView
- From: John Stiles <email@hidden>
- Date: Mon, 21 Apr 2008 17:01:12 -0700
I found thee things which, in conjunction, solve the problem:
1 - Rewrite synchronizedViewContentBoundsDidChange as follows.
-scrollToPoint seems broken. (I am clamping the scroll view to the left
side on purpose)
- (void)synchronizedViewContentBoundsDidChange:(NSNotification
*)notification
{
// get the changed content view from the notification
NSView *changedContentView=[notification object];
// get the origin of the NSClipView of the scroll view that
// we're watching
NSRect changedBounds = [changedContentView bounds];
[[self contentView] scrollRectToVisible:NSMakeRect(0,
changedBounds.origin.y, 1, changedBounds.size.height)];
// we have to tell the NSScrollView to update its scrollers
[self reflectScrolledClipView:[self contentView]];
}
2 - Disable non-contiguous layout. This seemed to cause the view to
scroll to the wrong place.
3 - An NSSplitView was causing my layout to shift around if it was
collapsed all the way, making things look more broken than they were...
grr. I don't know how to work around this problem without a big kludge;
we've filed a radar on AppKit back in 2006 with no word yet.
(rdar://4399290 - A cocoa view that is shrunk to a degenerate rectangle
loses its position & size)
John Stiles wrote:
Has anyone gotten this example to work in Leopard?
http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html
I just tried it and I'm having terrible luck. The view is just
blanking itself out immediately. I can get it to sort-of work if I
replace -scrollToPoint: with calling -scrollRectToVisible: on the
document, but it seems to screw up sometimes and go to the wrong
location. It's really weird.
My use case is fairly simple—I just want line numbers to the left of a
text view—and the code is basically unchanged (although I've tried
tweaking it a few times, with mixed results, never 100% working).
_______________________________________________
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