This works perfectly, just what I was looking for. Many thanks! F.
On Sat, Mar 29, 2008 at 4:39 PM, Steve Weller <[EMAIL PROTECTED]> wrote: > > Try looking at the source for TextEdit. TextEdit adds a pop-up at the > end of the horizontal scroller by overriding NSScrollView's tile: > method. You may be able to change the layout so that the end of the > NSScroller is clipped off. > > > > On Mar 29, 2008, at 4:57 AM, [EMAIL PROTECTED] wrote: > > Thanks Troy for the in-depth account. Yes, my goal is to customize the > > scroller's appearance, and yes, I wish this process involved less > > guess-work. As you say, there is no empty space when you let the > > scroller draw normally. You only see this when drawing a custom > > scroller based on the rects returned by -rectForPart:. That makes > > sense as those rects, as you say, are for hit-testing purposes only. > > Hence NSScrollerKnobSlot does not return the full rect for the slot, > > only the clickable part. I currently modify the rects returned by > > -rectForPart: for my drawings (eg. adjust the height and y position to > > cover the empty space), but I suppose calculating the parts based on > > the rect from the -drawRect: method would be even easier. My problem > > is I have a transparent table view and would prefer not to a have a > > slot for the knob at all, just a vertical scroller that goes all the > > way up to the edge of the table's header view, but it seems this is > > not possible. I can draw the knob in the designated slot cap area, but > > the drawing is messed up whenever the view is redisplayed. Oh well, > > the gap is only a few pixels, no big deal. > > > > On Fri, Mar 28, 2008 at 5:44 PM, Troy Stephens <[EMAIL PROTECTED]> > > wrote: > >> As Hamish Allan pointed out, a scroller has logical "parts", but they > >> are not subviews. -rectForPart: returns the bounding rects that are > >> used for hit-testing those parts. In the olden days of OpenStep- > >> style > >> Scrollers and their purely rectangular parts, these were exact and > >> the > >> same rects used for drawing. On Mac OS X, they are only hit testing > >> bounding rects (since Scrollers now have curved parts), and do not > >> affect drawing of the Scroller, only hit-testing. > >> > >> So all that rectForPart:NSScrollerNoParts is telling you is that > >> there's a skinny rect at the top of the scroller that is not > >> sensitive > >> to hit-testing. That makes sense, since there is a nonreactive end > >> cap on the scroll track that has no arrow (when Appearance prefs are > >> set for the scroll arrows to be shown "Together" at the other end). > >> This isn't an "empty" space when you let the scroller draw normally > >> though -- there's art there, or at least there should be. If you're > >> seeing otherwise, something else must be wrong. Can you clarify > >> whether you're seeing this when the scroller draws normally, or only > >> with your test drawing based on the -rectForPart: results in place? > >> > >> If your goal is to subclass NSScroller to customize its appearance, I > >> should add that the -drawParts and -drawArrow:highlight: methods are > >> obsolete and is no longer invoked by NSScroller's drawing code. > >> Those > >> methods should be deprecated. There are some other difficulties with > >> customizing Scroller appearance using the existing API, and we have > >> at > >> least one request to make that easier in the future. > >> > >> > >> > >> On Mar 27, 2008, at 6:17 PM, [EMAIL PROTECTED] wrote: > >>> Yes, I meant scroller, not slider. Just had a glass of wine too > >>> much :-) > >>> > >>> Actually I don't want to add an accessory view, I want to get rid of > >>> the one that appears to be there by default. I have attached a > >>> screenshot showing what I'm talking about. The yellow part is the > >>> knob, drawn by filling the rect return by calling [self > >>> rectForPart:NSScrollerKnob]. The green part is the slot, [self > >>> rectForPart:NSScrollerKnobSlot]. The white part above the slot is by > >>> default black, but here I made it white by filling the rect returned > >>> by calling [self rectForPart:NSScrollerNoParts]. > >>> > >>> I can move the knob/slot upwards by tampering with their designated > >>> rects ("rect.origin.y -= 5"), thus hiding the white part. But that > >>> messes up the drawing when the view is updated. > >>> > >>> I figured the white part was a view, but since you are telling me > >>> NSScroller has no subviews I really don't know what to think. Maybe > >>> there is something wrong with my implementation? > >>> > >>> @implementation TestScroller > >>> > >>> - (void)drawRect:(NSRect)rect > >>> { > >>> [self drawKnobSlot]; > >>> [self drawKnob]; > >>> } > >>> > >>> - (void)drawKnob > >>> { > >>> NSRect rect = [self rectForPart:NSScrollerKnob]; > >>> [[NSColor yellowColor] set]; > >>> [NSBezierPath fillRect:rect]; > >>> } > >>> > >>> - (void)drawKnobSlot > >>> { > >>> NSRect rect = [self rectForPart:NSScrollerKnobSlot]; > >>> [[NSColor greenColor] set]; > >>> [NSBezierPath fillRect:rect]; > >>> } > >>> > >>> @end > >>> > >>> On Fri, Mar 28, 2008 at 12:41 AM, Troy Stephens > >>> <[EMAIL PROTECTED]> wrote: > >>>> > >>>> On Mar 27, 2008, at 4:26 PM, [EMAIL PROTECTED] wrote: > >>>>> Thanks, but the corner view is the right side corner of the header > >>>>> view, right? I was talking about the small view just below it, on > >>>>> top > >>>>> of the vertical slider and part of the slider itself. It's a tiny > >>>>> view > >>>>> of about 2 pixels height. I believe it corresponds to > >>>>> NSScrollerNoPart, but I'm not sure. > >>>> > >>>> (By "slider" I take it you really mean "scroller", as NSSlider is > >>>> something else entirely. :-) > >>>> > >>>> An NSScroller (currently) has no subviews, but if your aim is to > >>>> add > >>>> one or more accessory views above the scroller, that can be done by > >>>> subclassing NSScrollView. The key is to override NSScrollView's - > >>>> tile > >>>> method to invoke [super tile], and then adjust the layout to > >>>> accommodate your accessory subview(s). Figure out where you want > >>>> your > >>>> accessory subview(s) to go, set their frame(s), and change the > >>>> ScrollView's verticalScroller's frame (shrink and move down, since > >>>> ScrollViews are flipped) to make room for them. > >>>> > >>>> > >>>> > >>>>> > >>>>> > >>>>> On Thu, Mar 27, 2008 at 9:53 PM, Troy Stephens <[EMAIL PROTECTED] > >>>>> > > >>>>> wrote: > >>>>>> > >>>>>> On Mar 27, 2008, at 9:50 AM, [EMAIL PROTECTED] wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> NSScroller has a small view, by default two pixels high, just > >>>>>>> above > >>>>>>> the scroller and below the NSTableHeaderView's corner view. How > >>>>>>> can I > >>>>>>> get at this view? If you look at the XCode interface you can see > >>>>>>> they > >>>>>>> have put an icon in this view (the one that splits the editor > >>>>>>> view) > >>>>>>> and made it larger. I would like to remove the view completely > >>>>>>> so > >>>>>>> the > >>>>>>> scroller goes all the way up to the edge of the corner view. > >>>>>>> > >>>>>>> This question has been addressed before in the archives, but > >>>>>>> unfortunately the link pointing to an answer is no longer valid. > >>>>>>> > >>>>>>> Thanks. > >>>>>>> F. > >>>>>> > >>>>>> See NSTableView.h: > >>>>>> > >>>>>> /* Get and set the cornerView. The cornerView is the view that > >>>>>> appears > >>>>>> directly to the right of the headerView above the vertical > >>>>>> NSScroller. > >>>>>> The scroller must be present for the cornerView to be shown. > >>>>>> Calling - > >>>>>> setCornerView: may have the side effect of tiling the > >>>>>> enclosingScrollView to accomodate the size change. The default > >>>>>> value > >>>>>> is an internal class that properly fills in the corner. > >>>>>> */ > >>>>>> - (void)setCornerView:(NSView *)cornerView; > >>>>>> - (NSView *)cornerView; > >>>>>> > >>>>>> -- > >>>>>> Troy Stephens > >>>>>> Cocoa Frameworks > >>>>>> Apple, Inc. > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>> > >>>> > >>>> -- > >>>> Troy Stephens > >>>> Cocoa Frameworks > >>>> Apple, Inc. > >>>> > >>>> > >>>> > >>>> > >>> <Picture 2.png> > >> > >> > >> > >> > >> -- > >> Troy Stephens > >> Cocoa Frameworks > >> Apple, Inc. > >> > >> > >> > >> > > _______________________________________________ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > 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: > > http://lists.apple.com/mailman/options/cocoa-dev/bagelturf%40mac.com > > > > This email sent to [EMAIL PROTECTED] > > -- > Blog: http://www.bagelturf.com/ Photos: http://bagelturf.smugmug.com/ > > > > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]