NSScrollView scroll wheel problem
NSScrollView scroll wheel problem
- Subject: NSScrollView scroll wheel problem
- From: Matt Smith <email@hidden>
- Date: Fri, 20 Oct 2006 18:42:40 -0700
I have an NSScrollView with a custom subview as its documentView. I
have set the NSScrollView up in IB and set it so that it
automatically hides scrollers. My problem occurs after resizing the
window so that the scroll bars appear, then resizing it again so that
they disappear. After doing that when I use the mighty mouse scroll
wheel the NSScrollView's document view ( my custom view ) disappears.
When I resize the window it pops back into view. I have implemented
the following fix in my custom view that solves the problem but it
shouldn't be necessary.
- (void)scrollWheel:(NSEvent *)theEvent
{
NSScrollView *scrollView;
NSRect horizontalScrollerRect;
NSRect verticalScrollerRect;
scrollView = (NSScrollView *)[[self superview] superview]; //my
superview is the NSClipView, the NSClipView's super view is NSScrollView
verticalScrollerRect = [[scrollView verticalScroller]
rectForPart:NSScrollerKnobSlot];
horizontalScrollerRect = [[scrollView horizontalScroller]
rectForPart:NSScrollerKnobSlot];
if ( [scrollView hasHorizontalScroller] && [self
bounds].size.width > horizontalScrollerRect.size.width ) {
[super scrollWheel:theEvent];
}
if ( [scrollView hasVerticalScroller] && [self
bounds].size.height > verticalScrollerRect.size.height ) {
[super scrollWheel:theEvent];
}
}
Any information would be greatly appreciated.
Thanks,
Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden