Re: Why is scrollbar enabled? - SOLVED
Re: Why is scrollbar enabled? - SOLVED
- Subject: Re: Why is scrollbar enabled? - SOLVED
- From: Eric Gorr <email@hidden>
- Date: Thu, 1 Oct 2009 14:40:37 -0400
If anyone is interested, I finally found what the problem was...first,
it goes back to this old message in the archives:
Re: setEnabled on a NSView
http://lists.apple.com/archives/cocoa-dev/2002/Feb/msg01312.html
I needed to do this exactly thing. I have a custom view and I wanted
an easy want to enable or disable all of the controls within the view.
The problem is that setSubViewsEnabled will happily traverse into a
NSScrollView, find the NSScroller's, and enable them. As best I can
determine (which makes perfect sense) is that a NSScrollView wants
full control over whether it's NSScroller's are enabled or not. If
they are enabled, they will show the knob. So, because I called
setSubViewsEnabled, I ended up enabling NSScroller's that I shouldn't
have.
So, I changed the if statement to:
if ( [currentView respondsToSelector:@selector(setEnabled:)]
&& [currentView isKindOfClass:[NSScroller class]] == NO ) {
Basically, I assume it should always be the case that whomever
contains a NSScroller, they will maintain the enabled / disabled state
of that particular control.
If anyone has any suggestions on how this might be better handled, I
would be interested.
On Sep 28, 2009, at 12:19 PM, Eric Gorr wrote:
I'm sure there is something trivial that I am missing,
While the application is running and not doing anything in
particular, I generate the following information about the state of
the NSScroller:
Content View Frame: {{1, 1}, {445, 594}}
Content View Bounds: {{0, 0}, {445, 594}}
Scroll Frame Size: {{0, 0}, {458, 596}}
Document Frame: {{0, 0}, {445, 0}}
Document Bounds: {{0, 0}, {445, 0}}
with:
NSLog( @"Content View Frame: %@", NSStringFromRect( [[[self
enclosingScrollView] contentView] frame] ) );
NSLog( @"Content View Bounds: %@", NSStringFromRect( [[[self
enclosingScrollView] contentView] bounds] ) );
NSLog( @"Scroll Frame Size: %@", NSStringFromRect( [[self
enclosingScrollView] frame] ) );
NSLog( @"Document Frame: %@", NSStringFromRect( [[[self
enclosingScrollView] documentView] frame] ) );
NSLog( @"Document Bounds: %@", NSStringFromRect( [[[self
enclosingScrollView] documentView] bounds] ) );
So, based on what I am seeing here, the document view has a zero
height, so why would the vertical scroll bar be lit up?
Here are some images that might be helpful:
http://ericgorr.net/cocoadev/scrollbar/
DocumentView.png - some information on how I have the document view
setup in IB
NSScroller.png - some information on how I have the NSScroller setup
in IB
scrollview.png - what it looks like when running in my application
Anyone have any thoughts?
_______________________________________________
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:
@ericgorr.net
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