Thank you all for your patience and kindness in educating me.
I appreciate it very much. I will sub-class which is what I have previously 
done.
This was, for me, a bit of an experiment (which failed). But that's also a good 
result.

Thanks again.

Peter
On 2012-04-02, at 12:44 AM, Jens Alfke wrote:
> On Mar 31, 2012, at 6:46 PM, Peter Teeson wrote:
>> In my app there is only the one NSMatrix instance 
> 
> There's no way to tell, really. For all I know, the Open or Save panels might 
> use NSMatrix.
> Or the Find panel or the font panel. Heck, I believe in the old days of 
> OpenStep,
> menus were implemented as NSMatrixes of menu item cells.
> 
> Also, if you ever need to add another different NSMatrix somewhere else in 
> your app,
> you're now SOL because you'll now have to rip out the category method and 
> re-implement
> your code the right way using subclassing.
> 
>> Although I do [super drawRect] after my own drawing.
> 
> That won't call the old NSMatrix drawRect, it'll call the drawRect of the 
> superclass of NSMatrix,
> which is NSControl. You've effectively deleted the original NSMatrix drawRect 
> implementation,
> so it's impossible to call it without some tricky gymnastics. One more time: 
> a category doesn't override
> a method, it replaces it. It literally edits the class's method table to 
> replace the old function pointer with the new one.
> The only way to properly override a method, in the OOP sense, is to make a 
> subclass.
> 
> —Jens

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to