• 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: NSScroller width
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScroller width


  • Subject: Re: NSScroller width
  • From: Massimiliano Gargani <email@hidden>
  • Date: Mon, 31 Aug 2009 10:34:37 +0200

Thanks a lot,

I had to subclass also the scroll view but it partially works.

Now my code is:

@implementation MyScroller

+ (CGFloat)scrollerWidth {
	return 40.0f;
}

+ (CGFloat)scrollerWidthForControlSize:(NSControlSize)controlSize
{
	return 40.0f;
}

- (void)drawRect:(NSRect)rect
{
	[self drawKnobSlot];
	[self drawKnob];
}

- (void)drawKnob
{
	NSRect rect = [self rectForPart:NSScrollerKnob];
	rect.origin.x =0;
	rect.size.width = 40;

	[[NSColor darkGrayColor] set];
	[NSBezierPath fillRect:rect];
}

- (void)drawKnobSlot
{
	NSRect rect = [self rectForPart:NSScrollerKnobSlot];
	rect.origin.x = 0;
	rect.size.width = 40;
	[[NSColor grayColor] set];
	[NSBezierPath fillRect:rect];
}

@end


The knob's width is still 15.0f

As you can see from image here:

http://img30.imageshack.us/img30/3586/immagine1jvf.png

the knob's rect is splitted in 2 rects:

the right rect works fine and scroll my table, the left rect doesn't scroll and if i try to click on it or drag it it moves the windo to its origin.x and y

I found no documentation about a knobwidth or something.

Thanks for any help or hints.

Max



Il giorno 30/ago/09, alle ore 21:20, Brandon Walkin ha scritto:

Use +scrollerWidth and +scrollerWidthForControlSize. Here's a custom scroller subclass from BWToolkit which might help you out: http://bitbucket.org/bwalkin/bwtoolkit/src/tip/BWTransparentScroller.m

Brandon

On 2009-08-30, at 5:25 AM, Massimiliano Gargani wrote:

Hi there,

I've googled a lot before post this question but I'm stucked.

I'm trying to subclassing NSScroller to change the aqua look and, most important, to change the width of the vertical scroll bar.

My subclass is:

- (void)drawRect:(NSRect)rect
{
 [self drawKnobSlot];
 [self drawKnob];
}

- (void)drawKnob
{
 NSRect rect = [self rectForPart:NSScrollerKnob];
 [[NSColor darkGrayColor] set];
 [NSBezierPath fillRect:rect];
}

- (void)drawKnobSlot
{
 NSRect rect = [self rectForPart:NSScrollerKnobSlot];
 [[NSColor grayColor] set];
 [NSBezierPath strokeRect:rect];
}

It works and change the look as I want but not the width. I tried to set rect width but is not the right way because the rect goes beyond the scrollview.

Any help is appreciated.

Thanks,
Max

_______________________________________________

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


References: 
 >NSScroller width (From: Massimiliano Gargani <email@hidden>)
 >Re: NSScroller width (From: Brandon Walkin <email@hidden>)

  • Prev by Date: system(root) locale
  • Next by Date: Build error
  • Previous by thread: Re: NSScroller width
  • Next by thread: NSFileManager copyItem and 64 Bit not able to copy a symlink?
  • Index(es):
    • Date
    • Thread