On Jun 25, 2008, at 9:39 PM, Graham Cox wrote:
On 26 Jun 2008, at 6:01 am, Kevin Elliott wrote:
There is no reason to subclass his control to attach an int value
(or more generally to track which instance a particular control
is). See NSControl tag/setTag. They allow you to do exactly what
he wants.
Well, not quite - tags store ints, whereas a Carbon Control refCon
is *typically* used to store a pointer or Handle, so I didn't
mention it to avoid misleading the OP into thinking that tags and
refCons were semantically identical.
Also, it's important to point out that Cocoa and Objective-C will
treat a tag as an integer, period, rather than as a pointer to an
object. They may be equivalent under non-GC, but under Objective-C
Garbage Collection the collector *will* collect an object whose only
remaining references are in integers like control tags.
If you want to refer to an object, you should really refer to it via a
variable of appropriate type.
-- Chris
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]