Re: NSSlider and NSSliderCell
Re: NSSlider and NSSliderCell
- Subject: Re: NSSlider and NSSliderCell
- From: Michael Watson <email@hidden>
- Date: Mon, 15 Jan 2007 20:20:07 -0500
Yeah, this is exactly the problem. I figured it out right as I opened
this e-mail, thinking about a previous reply's suggestion to use -
initWithCoder:.
I've intercepted that method and have successfully switched out the
cell class. It draws a little funny, but that's not a big mountain to
climb.
Thanks, everyone. (-:
--
mikey
On 15 Jan, 2007, at 20:16, Murat Konar wrote:
On Jan 15, 2007, at 3:55 PM, Michael Watson wrote:
I've tried eleventeen different ways of setting the cell class so
the slider subclass creates and uses the custom subclassed cell,
but it always uses the standard NSSliderCell, not the custom cell.
[snip]
When the slider wakes up from the nib...
Stop right there.
What happens when your slider is reanimated from a nib is that it
is unarchived from the bits that you indirectly archived when you
made your nib. Since Interface Builder only knows about NSSlider
and NSSliderCell, that's what gets archived. That means your
sliders values, and crucially, the cell it uses are restored
directly from the archived nib data, not created dynamically by
your subclass.
You have a couple of things you could try:
(a) write your own Interface Builder Palette that makes your
subclass directly available to Interface Builder
(b) in your subclass' initWithCoder: method, call the super
implementation. At this point your cell should be an instance of
NSSliderCell. Dump it and substitute your own.
Option (a) is probably more trouble than it is worth. Option (b)
may or may not be more work than its worth (I've never tried it
myself, so there may be potholes I haven't anticipated).
_murat
_______________________________________________
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:
40bungie.org
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