On Feb 28, 2011, at 22:36, Deepa wrote:

> I am already displaying a NSTableview with one column. The tableview is 
> disabled and I do not allow the user to select any row of the tableview. In 
> each row of this column I display a NSTextFieldCell.
> 
> Now, I want to add one more column that displays NSButtonCell in a row when 
> some condition on that row is satisfied. User should be able to click on this 
> button and send some action.
> 
> If I disable the tableview  or if I do not allow the user to select the row 
> of a tableview, the button cell does not take any action. How do I achieve 
> this?

You should be able to achieve this using the 
'tableView:shouldTrackCell:forTableColumn:row:' delegate method of NSTableView:

        
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html

You may have to leave the table enabled, though, and use other means to prevent 
row selection and cell editing from working.

> Also, what is the best way to conditionally add a cell to a row?

Probably using another delegate method, 'tableView:dataCellForTableColumn:row:' 
(in the same document).

Also, although it's not documented and so perhaps can't be relied upon, but 
I've found that you can return 'nil' from this method to use the normal cell 
for the row/column. That saves a bit of work if you only need to supply a cell 
for a few special rows.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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]

Reply via email to