• 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: figuring out which TableView I am?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: figuring out which TableView I am?


  • Subject: Re: figuring out which TableView I am?
  • From: David Scheidt <email@hidden>
  • Date: Sat, 25 Apr 2009 14:54:12 -0400


On Apr 25, 2009, at 1:34 PM, WT wrote:

On Apr 25, 2009, at 7:26 PM, David Scheidt wrote:

On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - setTag. I would suggest assigning a different tag value to each instance of your NSTableView subclass (you'd do that in your subclass' initializer or -awakeFromNib method) and use the -tag method to identify the instance when you need to do so.

That's perfect. Thanks!

You're welcome. It's my impression that tags are generally under- utilized, though very useful.

Yes, certainly very useful: makes this problem a switch statement. (And not fogetting to set them in IB, but I made tag == 0 and the default: case different ugly colors, so I'll know that someone forgot to set the right tag (default is zero), or set it to an invalid value when I see them.) I've got a couple other places in this project where they'll likely make sense to use, for much the same reasons.




It's also possible to set the tag in IB (it's on the Attributes Inspector palette, in the "control" tab). Since I'm not creating any dynamically, I can do that.

It's funny... I fired up IB and created a fake app to check if it was possible to set the tag through IB before I replied to your first message but, in my haste, missed it so I thought you'd have to do it in code.

Well, I'd never used them before. So I looked them up in the NSControl class docs, which say " Tag values are not used internally; they are only changed by external invocations of setTag:. You typically set tag values in Interface Builder and use them at runtime in your application", so I figured there had to be a way to set them, and just looked until i found it.
_______________________________________________


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:
    • Re: figuring out which TableView I am?
      • From: Jonathan Hess <email@hidden>
References: 
 >figuring out which TableView I am? (From: David Scheidt <email@hidden>)
 >Re: figuring out which TableView I am? (From: WT <email@hidden>)
 >Re: figuring out which TableView I am? (From: David Scheidt <email@hidden>)
 >Re: figuring out which TableView I am? (From: WT <email@hidden>)

  • Prev by Date: Re: Dividing NSView to subviews
  • Next by Date: Re: undoMenuTitleForUndoActionName
  • Previous by thread: Re: figuring out which TableView I am?
  • Next by thread: Re: figuring out which TableView I am?
  • Index(es):
    • Date
    • Thread