Re: NSSlider and NSSliderCell
Re: NSSlider and NSSliderCell
- Subject: Re: NSSlider and NSSliderCell
- From: Andreas Mayer <email@hidden>
- Date: Tue, 16 Jan 2007 02:24:33 +0100
Am 16.01.2007 um 00:55 Uhr schrieb Michael Watson:
But -initWithFrame: is never called.
Are you getting your slider from a nib file? Then you need to
implement -awakeFromNib instead.
Here's my implementation:
- (void)awakeFromNib
{
if ([[self cell] class] != [MySliderCell class]) {
// replace cell
NSSliderCell *oldCell = [self cell];
NSSliderCell *newCell = [[[MySliderCell alloc] init] autorelease];
[newCell setTag:[oldCell tag]];
[newCell setAction:[oldCell action]];
[newCell setControlSize:[oldCell controlSize]];
[newCell setType:[oldCell type]];
[newCell setState:[oldCell state]];
[newCell setAllowsTickMarkValuesOnly:[oldCell
allowsTickMarkValuesOnly]];
[newCell setAltIncrementValue:[oldCell altIncrementValue]];
[newCell setControlTint:[oldCell controlTint]];
[newCell setKnobThickness:[oldCell knobThickness]];
[newCell setMaxValue:[oldCell maxValue]];
[newCell setMinValue:[oldCell minValue]];
[newCell setDoubleValue:[oldCell doubleValue]];
[newCell setNumberOfTickMarks:[oldCell numberOfTickMarks]];
[newCell setSliderType:[oldCell sliderType]];
[newCell setEditable:[oldCell isEditable]];
[newCell setEnabled:[oldCell isEnabled]];
[newCell setEntryType:[oldCell entryType]];
[newCell setFocusRingType:[oldCell focusRingType]];
[newCell setHighlighted:[oldCell isHighlighted]];
[newCell setTarget:[oldCell target]];
[newCell setTickMarkPosition:[oldCell tickMarkPosition]];
[self setCell:newCell];
}
}
Andreas
_______________________________________________
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