Re: drawKnob in NSSliderCell subclass
Re: drawKnob in NSSliderCell subclass
- Subject: Re: drawKnob in NSSliderCell subclass
- From: "Christoph Teschner" <email@hidden>
- Date: Thu, 18 May 2006 05:19:04 +0200
Hi,
I was not quite sure where to put the empty sizeToFit, so I put it in my
sliderCell and in my slider (both with logs), but non of them even get
called. I have no idea what's going wrong. When should the sizeToFit be
called? Here is my current code, perhaps you see what I am doing wrong:
@implementation MySliderCell
-(id)init {
self = [super init];
knobImage = [[NSImage imageNamed:@"GotoEnd.tif" ]retain];
return self;
}
- (void)sizeToFit {NSLog(@"SizeToFit in MySliderCell");}
- (void)drawKnob:(NSRect)knobRect {
[[self controlView] lockFocus];
[knobImage
compositeToPoint:NSMakePoint(knobRect.origin.x,knobRect.origin.y+knobRect.size.height)
operation:NSCompositeSourceOver];
[[self controlView] unlockFocus];
}
- (void)awakeFromNib {
NSCell *oldCell = [self cell];
MySliderCell * aCell = [[[MySliderCell alloc] init] retain];
[aCell setAction:[oldCell action]];
[aCell setTarget:[oldCell target]];
[self setCell:aCell];
[aCell release];
}
- (void)sizeToFit {NSLog(@"SizeToFit in MySlider");}
Thank you for your help!
Christoph
From: George Orthwein <email@hidden>
To: Christoph Teschner <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: drawKnob in NSSliderCell subclass
Date: Wed, 17 May 2006 21:57:22 -0400
It looks like all you need is an empty sizeToFit...
http://www.cocoabuilder.com/archive/message/cocoa/2004/9/17/117721
http://www.cocoabuilder.com/archive/message/cocoa/2005/4/1/132006
George
_______________________________________________
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