• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScrollView custom thumbs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScrollView custom thumbs


  • Subject: Re: NSScrollView custom thumbs
  • From: Milton Sagen <email@hidden>
  • Date: Mon, 18 Dec 2006 16:28:44 -0800

I found that doing just that wasn't enough at least if the NSScrollView comes from a nib. Simply calling setVerticalScroller or setHorizontalScroller with an instance of my scroller when the NSScrollView was created via a nib resulted in scrollbars that didn't draw or behave correctly. Instead I subclassed NSScrollView, in addition to subclassing NSScroller, and implemented initWithCoder: method in my NSScrollView subclass as

- (id) initWithCoder: (NSCoder *) decoder
{
BOOL useSetClass = NO;
BOOL useDecodeClassName = NO;

if ( [decoder respondsToSelector: @selector (setClass:forClassName:)] ) {
useSetClass = YES;
[(NSKeyedUnarchiver *) decoder setClass: [MyScroller class] forClassName: @"NSScroller"];

}
else if ( [decoder respondsToSelector: @selector (decodeClassName:asClassName:)] ) {
useDecodeClassName = YES;
[(NSUnarchiver *) decoder decodeClassName: @"NSScroller" asClassName: @"MyScroller"];
}


	self = [super initWithCoder: decoder];

if ( useSetClass ) {
[(NSKeyedUnarchiver *) decoder setClass: [NSScroller class] forClassName: @"NSScroller"];
}
else if ( useDecodeClassName ) {
[(NSUnarchiver *) decoder decodeClassName: @"NSScroller" asClassName: @"NSScroller"];
}

return self;
}


Note: this code assumes nothing has already replaced NSScroller.

BTW: I also found that drawParts for my scroller subclass never got called.

Milt


On Dec 17, 2006, at 09:16, I. Savant wrote:


You'll need to subclass NSScroller and override -drawKnobs - drawParts and -drawArrow:highlight: (along with their supporting methods) and draw your own stuff.


--
I.S.


On Dec 17, 2006, at 11:32 AM, Lorenzo wrote:

Hi,
I would like to customize the thumbs of a NSScrollView and put e.g.
something like the iTunes' thumbs.
I suppose there should be 3 images to compose a thumb.
How to change those images?


Best Regards -- Lorenzo email: email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40gmail.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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)

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


References: 
 >NSScrollView custom thumbs (From: Lorenzo <email@hidden>)
 >Re: NSScrollView custom thumbs (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Using bindings to make an NSPopupButton to assign an array filter predicate
  • Next by Date: Re: Using bindings to make an NSPopupButton to assign an array filter predicate
  • Previous by thread: Re: NSScrollView custom thumbs
  • Next by thread: Stripping / Removing characters from String
  • Index(es):
    • Date
    • Thread