• 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: Disabling a particular NSButtonCell in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling a particular NSButtonCell in NSTableView


  • Subject: Re: Disabling a particular NSButtonCell in NSTableView
  • From: Felix Franz <email@hidden>
  • Date: Tue, 12 Jun 2007 18:43:20 +0200

On Jun 12, 2007, at 6:20 PM, K. Darcy Otto wrote:

I've used Interface Builder to set up an NSTableView, and in one column I have a column of NSButtonCell buttons. I want to disable the button at a certain row, while leaving the rest of the buttons enabled. My questions are two:

(i) how do I refer to a particular button at some arbitrary row?
(i) what message do I send the button so just that button becomes disabled?


You have to set a delegate for the NSTableView and implement the
tableView:willDisplayCell:forTableColumn:row:-method (described in the NSTableView-documentation).
This method is called before a particular cell is drawn. Something like (typed in Mail:)


- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if (![aTableColumn isEqual: buttonColumn])
return; // do nothing for the other columns


[aCell setEnabled: rowIndex != rowIndexToDisable]; // where rowIndexToDisable would be the row index with the disabled button
}


HTH,


felix

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >Disabling a particular NSButtonCell in NSTableView (From: "K. Darcy Otto" <email@hidden>)

  • Prev by Date: Re: programmatically adding model objects to NSOultineView/NSTreeController
  • Next by Date: dynamically sized text container
  • Previous by thread: Re: Disabling a particular NSButtonCell in NSTableView
  • Next by thread: dynamically sized text container
  • Index(es):
    • Date
    • Thread