• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SetControlReference equivalent in NSControl?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SetControlReference equivalent in NSControl?


  • Subject: Re: SetControlReference equivalent in NSControl?
  • From: Graham Cox <email@hidden>
  • Date: Thu, 26 Jun 2008 14:39:12 +1000


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.


Additionally if you want to attach some sort of object (say a string or something more complex that needs to be retained) see representedObject/setRepresentedObject. It's part of NSCell not NSControl, but most of the complex controls have a NSCell subclass anyway (i.e. an NSButtonCell is attached to every NSButton).

Right, I'd overlooked that one. This sounds much more appropriate.



G.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • tag != pointer under GC (was Re: SetControlReference equivalent in NSControl?)
      • From: Chris Hanson <email@hidden>
References: 
 >SetControlReference equivalent in NSControl? (From: email@hidden)
 >Re: SetControlReference equivalent in NSControl? (From: Graham Cox <email@hidden>)
 >Re: SetControlReference equivalent in NSControl? (From: Kevin Elliott <email@hidden>)

  • Prev by Date: Re: Creating Installer Package from Cocoa
  • Next by Date: tag != pointer under GC (was Re: SetControlReference equivalent in NSControl?)
  • Previous by thread: Re: SetControlReference equivalent in NSControl?
  • Next by thread: tag != pointer under GC (was Re: SetControlReference equivalent in NSControl?)
  • Index(es):
    • Date
    • Thread