Declare a color as property

According to OOP standards,

seems more conform. When you call

and then

are you sending messages to the same object?

Do you mean where you use alloc] init] in +(MyButtonCell *)cellWithTag:(NSUInteger) tag color:(NSColor *)color title:(NSString *)title ? If so, it’s a class method so I think you should probably be using:

MyButtonCell *myCell = [[self alloc]init];

Yes, that’s where I meant. I guess I was thinking that I had to call super to get an alloc or init to work, but I guess I get that by inheritance anyway. So, I changed it to self, and of course that worked.

But I still don’t understand why using “super” vs. “NSButtonCell” should give different results. Since my class is a subclass of NSButtonCell, isn’t “super” just a stand in for “NSButtonCell”?

Ric

I don’t really know – as far as I can see, neither should have worked.

Hello,

Sorry to reactivate an old topic, but if I make:

property NSColor : class "NSColor"
property pureWhite : NSColor's whiteColor()

I get this error:

myAppDelegate.applescript:24: error: class “NSColor” doesn’t understand the whiteColor message. (-1708)

It’s a class method, isn’t it? Is the error message appropriate?

Thanks,

You can’t set a property’s initial value to a method call.

Yet it would be convenient … Too bad. :confused:

So would something like:

property:application Finder's name

But it’s never been possible.

This is what init methods are for.