Skip navigation.
 
mlRe: dataCellForTableColumn method
FROM : Hans Hansen
DATE : Thu Mar 20 17:33:41 2008

Well I found a work around using preparedCellAtColumn:row: and then 
calling selectWithFrame directly...

...but there has got to be a better way! :D

On Mar 19, 2008, at 2:58 PM, Hans Hansen wrote:

> Anyone know how best to use multiple NSTextCell subclasses, in a 
> table/outline column?
>
> When I use the dataCell... methods in NSTableColumn, NSTableView, or 
> NSOutlineView, it works great until I try to edit the cell, at which 
> point the cells never receive the edit/select actions. I've tried 
> lots of things but can't figure out what's happening, nor a better 
> why to do this overall.
>
> In other words:
>
> When I use the dataCellForTableColumn method, my table does display 
> the different textcell subclasses returned. But when I send the 
> table/outline [self editColumn:1 row:[self selectedRow] 
> withEvent:theEvent select:YES] message it seems to get lost -- my 
> specified cells don't receive an editWithFrame/selectWithFrame 
> action. If I remove this method and only use one cell class in the 
> column, it works as expected.
>
> - (NSCell *)outlineView:(NSOutlineView *)outlineView 
> dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
>
>     if ([item isKindOfClass:[Project class]]) return projectTextCell;
>     if ([item isKindOfClass:[Action class]]) return actionTextCell;
>     if ([item isKindOfClass:[Item class]]) return itemTextCell;
>     if ([item isKindOfClass:[Note class]]) return noteTextCell;
>
>     return nil;
> }
>
> The point of this is to breakout my cell designs for efficiency and 
> comprehension. But so far it's just making me nuts. ;-).
>

Related mailsAuthorDate
mldataCellForTableColumn method Hans Hansen Mar 19, 19:58
mlRe: dataCellForTableColumn method Ben Lachman Mar 20, 02:53
mlRe: dataCellForTableColumn method Hans Hansen Mar 20, 17:33