Re: Hiding NSButtonCell
Re: Hiding NSButtonCell
- Subject: Re: Hiding NSButtonCell
- From: Graham Cox <email@hidden>
- Date: Tue, 6 Jul 2010 10:11:14 +1000
On 06/07/2010, at 4:56 AM, Rainer Standke wrote:
> setEnabled works on single cells, and as expected: the outline row's button is grayed out. Oddly, setTransparent affects all cells in the column, i.e. the button appears in no row, not even the ones that have no children.
>
> That's confusingly inconsistent, to me. What should I do to make invisible only the checkboxes in the row that have a twirly triangle?
There is only one cell, reused for each row in the column as needed.
Therefore you not only need to disable the cell/make it transparent, but set the opposite state for all other rows, otherwise it just remains in the last state you set.
If you just want to hide it for 'parent' items, this method can also refer to the other delegate method - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item. Presumably your controller/data model can determine which items are parent items since the outline view is told this information by you:
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
if ( [[tableColumn identifier] isEqualToString:@"toReconnect"] )
{
[cell setEnabled:![self outlineView:outlineView isGroupItem:item]];
[cell setTransparent:[self outlineView:outlineView isGroupItem:item]];
}
}
--Graham
_______________________________________________
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