I am using a "SourceList" OutlineView and cannot get the content of the "header" and "data" NSTableCellViews to display. The structure of the OutlineView works and my app runs and looks similar to this, http://i.stack.imgur.com/0E4D8.png.
Here is my code:
- (id)init {
self = [super init];
if (self) {
_masterFolder = [[NSMutableArray alloc] init];
MasterFolder *trueMaster = [[MasterFolder alloc] initMaster:#"Categories"];
[_masterFolder addObject:trueMaster];
[trueMaster addChild:[[MasterFolder alloc] initMaster:#"World"]];
[trueMaster addChild:[[MasterFolder alloc] initMaster:#"Sports"]];
[trueMaster addChild:[[MasterFolder alloc] initMaster:#"Local"]];
[trueMaster addChild:[[MasterFolder alloc] initMaster:#"Business"]];
[(MasterFolder *)[trueMaster.children objectAtIndex:0] addChild:[[MasterFolder alloc] initMaster:#"Middle East"]];
}
return self;
}
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
return !item ? [self.masterFolder count] : [[item children] count];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
return !item ? YES : [[item children] count] != 0;
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
return !item ? [self.masterFolder objectAtIndex:index] : [[item children] objectAtIndex:index];
}
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
if (![item isKindOfClass:[MasterFolder class]]) {
return [outlineView makeViewWithIdentifier:#"HeaderCell" owner:self];
} else {
NSTableCellView *cellView = [outlineView makeViewWithIdentifier:#"DataCell" owner:self];
cellView.textField.stringValue = [((MasterFolder *)item) name];
return cellView;
}
}
I know it is an issue with this function:
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
but I do not know what to change to make it work. I have viewed a lot of similar posts on Stack Overflow already, and was not able to get the solutions that were offered to work.
Related
I am trying to create a custom popup menu in a tableview. As I understand it I can should be able to do so by calling the [NSPopupButtonCell setView:myView] method passing in the custom view (which is just a NSView with an NSOutlineView in it).
So I have created a NSPopupButtonCell subclass and during initialisation I call setView and pass in the custom outline view..
EDIT
In IB I have set the table columns cell to a Popup Button Cell and set
the class to my custom LookupPopupButtonCell.
I still don't get my custom view displaying but my custom classes
initialisation methods appear to be getting called.
I have since replaced this approach with using a NSTableViewDelegate method dataCellForTableColumn. Now the popup shows my custom tableView.
Still no joy in getting the NSOutlineViewDelegate methods called though.
EDIT
OK I have managed to get things working using a NSPopupButton on a view. delegate works find and table view displays things fine. Seems that using NSPopupButtonCell the delegate methods never get called.
#implementation LookupPopupButtonCell
- (id)init
{
LOG(#"init called");
self = [super init];
if (self) {
[self initialise];
}
return self;
}
- (void)initialise
{
LOG(#"initialise called");
[self setFont:[NSFont fontWithName:#"System Regular" size:11]];
[self setBordered:NO];
[self setBezeled:NO];
// Set the Task Lookup Popup Menu
NSMenu *newLookupMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:#"Custom"];
NSMenuItem *newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:#"Lookup" action:nil keyEquivalent:#""];
[newItem setEnabled:YES];
TaskLookupViewController *viewController = [[TaskLookupViewController alloc] initWithNibName:#"TaskLookupViewController" bundle:nil];
[newItem setView:[viewController view]];
[newLookupMenu addItem:newItem];
[newItem release];
[self setMenu:newLookupMenu];
}
#end
#implementation TaskLookupViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Initialization code here.
[self initialise];
}
return self;
}
- (void)awakeFromNib{
LOG(#"awakeFromNib called...");
[self viewDidLoad];
}
- (void)viewDidLoad {
FLOG(#"viewDidLoad called for %#", self);
/*
FLOG(#" _outlineView is %#", _outlineView);
FLOG(#" _outlineView is %#", [_outlineView identifier]);
FLOG(#" _outlineView delegate is %#", [_outlineView delegate]);
FLOG(#" _outlineView dataSource is %#", [_outlineView dataSource]);
*/
[_outlineView setDataSource:self];
[_outlineView setDelegate:self];
[_outlineView reloadData];
[_outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
[_outlineView setNeedsDisplay];
[_outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:2] byExtendingSelection:NO];
/*
FLOG(#" _outlineView delegate is %#", [_outlineView delegate]);
FLOG(#" _outlineView dataSource is %#", [_outlineView dataSource]);
*/
//NSTableColumn *tableColumn = [[_outlineView tableColumns] objectAtIndex:0];
//LOG(#" setting bindings");
//[tableColumn bind: #"value" toObject: _treeController withKeyPath: #"arrangedObjects.displayName" options: nil];
}
- (void)initialise {
LOG(#"initialise called");
_topLevelItems = [[NSArray arrayWithObjects:#"Project", #"Tasks and Deliverables", #"Finance", nil] retain];
_childrenDictionary = [NSMutableDictionary new];
[_childrenDictionary setObject:[NSArray arrayWithObjects:#"Scope", nil] forKey:#"Project"];
//[_childrenDictionary setObject:[NSArray arrayWithObjects:#"Issues", #"Risks", nil] forKey:#"Quality"];
[_childrenDictionary setObject:[NSArray arrayWithObjects:#"WBS", #"Functions", nil] forKey:#"Tasks and Deliverables"];
[_childrenDictionary setObject:[NSArray arrayWithObjects:#"Expenses", #"Ongoing Costs", #"Timesheets", nil] forKey:#"Finance"];
//[_childrenDictionary setObject:[NSArray arrayWithObjects:#"Applications", #"Interfaces", nil] forKey:#"IT Systems"];
//[_childrenDictionary setObject:[NSArray arrayWithObjects:#"People", #"Setup", nil] forKey:#"Administration"];
}
- (NSArray *)_childrenForItem:(id)item {
LOG(#"_childrenForItem called");
NSArray *children;
if (item == nil) {
children = _topLevelItems;
} else {
children = [_childrenDictionary objectForKey:item];
}
//FLOG(#" children are %#", children);
return children;
}
#end
#implementation TaskLookupViewController (NSOutlineViewDataSource)
- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
LOG(#"outlineViewSelectionDidChange: called");
if ([_outlineView selectedRow] != -1) {
NSObject *item = [_outlineView itemAtRow:[_outlineView selectedRow]];
if ([_outlineView parentForItem:item] != nil) {
// Only change things for non-root items (root items can be selected, but are ignored)
FLOG(#" selected item is %#", item);
}
}
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
FLOG(#"outlineView:child:ofItem: called for item %#", item);
return [[self _childrenForItem:item] objectAtIndex:index];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
LOG(#"outlineView:isItemExpandable: called");
if ([outlineView parentForItem:item] == nil) {
return YES;
} else {
return YES;
}
}
- (NSInteger) outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
LOG(#"outlineView:numberOfChildrenOfItem: called");
FLOG(#" children count is %d", [[self _childrenForItem:item] count]);
return [[self _childrenForItem:item] count];
}
#end
#implementation TaskLookupViewController (NSOutlineViewDelegate)
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
LOG(#"outlineView:isGroupItem: called");
return [_topLevelItems containsObject:item];
}
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
LOG(#"willDisplayCell called");
[cell setTitle:#"Cell Title"];
}
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
LOG(#"outlineView:viewForTableColumn called");
// We just return a regular text view.
if ([_topLevelItems containsObject:item]) {
NSTextField *result = [outlineView makeViewWithIdentifier:#"HeaderTextField" owner:self];
// Uppercase the string value, but don't set anything else. NSOutlineView automatically applies attributes as necessary
NSString *value = [item uppercaseString];
[result setStringValue:value];
return result;
} else {
NSTextField *result = [outlineView makeViewWithIdentifier:#"ItemTextField" owner:self];
[result setStringValue:value];
return result;
}
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldExpandItem:(id)item;
{
LOG(#"outlineView:shouldExpandItem: called");
return YES;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
{
LOG(#"outlineView:shouldSelectItem: called");
return YES;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldCollapseItem:(id)item;
{
LOG(#"outlineView:shouldCollapseItem: called");
return NO;
}
#end
#implementation TaskLookupViewController (NSTableViewDelegate)
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
LOG(#"tableView:dataCellForTableColumn:row: called");
NSString *identifier = [tableColumn identifier];
if ([identifier isEqualToString:#"task"]) {
//LOG(#" task column setting the cell");
LookupPopupButtonCell *cellView = [[LookupPopupButtonCell alloc] init];
return cellView;
}
NSTextFieldCell *cellView = [tableView makeViewWithIdentifier:#"hoursCell" owner:self];
return cellView;
}
#end
It seems you must use a VIEW based tableView to get the delegate messages. Blah, now to figure out how to bind one of them to Core Data, hopefully its not too hard !
Is there any way to reuse the same menu for each row ? I guess as long as the dataSource is not recreated each time its probably not too bad, still there could be lots of rows in this hierarchy!
I'm trying to show some content in my NSTableView in my mac app.
#implementation OpenTasksViewController {
NSMutableArray *tasks;
}
- (id)init {
self = [super init];
if (self) {
tasks = [NSMutableArray array];
[tasks addObject: [[Task alloc] initWithTitle:#"HI"]];
}
return self;
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
return [tasks count];
}
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSTableCellView *cell = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
Task *t = [tasks objectAtIndex:row];
cell.textField.stringValue = t.title;
return cell;
}
This class implements the NSTableViewDataSource and NSTableViewDelegate protocols.
Sadly, my app doesn't show the content.
I tried using reloadData, but that didn't work either.
When I debug into the project, the stringValue of cell.textField is correct.
For learning purposes i would like to convert a cell-based NSOutlineView to a view-based one,
basically i would like the following:
instead of a normal cell, i'd like an 'image and text table cell view'
the image can be the stock NSApplicationIcon and the text can just be 'hello world' :)
I'd like to do this without using bindings and NSTreeController
Here is the 'worlds simplest NSOutlineView' example http://www.cocoasteam.com/Cocoa_Steam/Worlds_Simplest_Demo.html
I wonder if someone could modify it to make it view-based and work like i said above :) :)
I've tried looking at apple examples, and searching elsewhere on the internet but i still can't get it to work - so thanks very much in advance :)
I have created a little sample project which does just that.
Display a list of items
Edit the items in a master-detail fashion
Remove and add items
Usage of bindings
Check out besi/mac-quickies on github.
Most of the stuff is either done in IB or can be found in the AppDelegate
OK, so you want an NSOutlineView with ImageAndTextCell cells, right?
Let's do one of the most typical examples of this kind : a simple file explorer.
What we'll need :
an NSOutlineView (put an outline to your AppDelegate, as fileOutlineView)
create 3 columns in the Outline with the following Identifiers (set them up in Interface Builder) : NameColumn, SizeColumn, ModifiedColumn
Now, as for the rest, I'll do it all programmatically, so that you get a good idea of what's going on...
How to set it up (e.g. in - (void)awakeFromNib):
// set the Data Source and Delegate
[fileOutlineView setDataSource:(id<NSOutlineViewDataSource>)self];
[fileOutlineView setDelegate:(id<NSOutlineViewDelegate>)self];
// set the first column's cells as `ImageAndTextCell`s
ImageAndTextCell* iatc = [[ImageAndTextCell alloc] init];
[iatc setEditable:NO];
[[[fileOutlineView tableColumns] objectAtIndex:0] setDataCell:iatc];
Connecting the dots :
/*******************************************************
*
* OUTLINE-VIEW DATASOURCE
*
*******************************************************/
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
if ([item isFolder])
return YES;
else
return NO;
}
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
if (item==nil)
{
// Root
return [[filePath folderContentsWithPathAndBackIgnoringHidden] count];
}
else
{
if ([item isFolder])
{
return [[item folderContentsWithPathAndBackIgnoringHidden] count];
}
else
{
return 0;
}
}
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
if (item == nil)
{
// Root
return [[filePath folderContentsWithPathAndBackIgnoringHidden] objectAtIndex:index];
}
if ([item isFolder])
{
return [[item folderContentsWithPathAndBackIgnoringHidden] objectAtIndex:index];
}
// File
return nil;
}
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)theColumn byItem:(id)item
{
if ([[theColumn identifier] isEqualToString:#"NameColumn"])
{
return [item lastPathComponent];
}
else if ([[theColumn identifier] isEqualToString:#"SizeColumn"])
{
if ([item isFolder]) return #"--";
else return [NSString stringWithFormat:#"%d",[item getFileSize]];
}
else if ([[theColumn identifier] isEqualToString:#"ModifiedColumn"])
{
if ([item isFolder]) return #"";
else return [NSString stringWithFormat:#"%#",[item getDateModified]];
}
// Never reaches here
return nil;
}
/*******************************************************
*
* OUTLINE-VIEW DELEGATE
*
*******************************************************/
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
return YES;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
{
return NO;
}
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
[cell setDrawsBackground:NO];
if ([item isFileHidden]) [cell setTextColor:[NSColor grayColor]];
else [cell setTextColor:[NSColor whiteColor]];
if ([[tableColumn identifier] isEqualToString:#"NameColumn"])
{
if ([item isFolder])
[cell setImage:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] size:15.0];
else
[cell setImage:[[NSWorkspace sharedWorkspace] iconForFile:item] size:15.0];
if ([item isFileHidden])
{
[cell setFileHidden:YES];
}
else
{
[cell setFileHidden:NO];
}
}
}
Hint : ImageAndTextCell class can be found here. You'll also notice a few other methods I'm using, which are obviously NOT supported by Cocoa (e.g. isFileHidden, isFolder or folderContentsWithPathAndBackIgnoringHidden) but it's not that difficult to implement them yourself...)
To return view to OutlineView column Instead of using datasource method that return objectValue:
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)theColumn byItem:(id)item
USE THE DATASOURCE METHOD THAT RETURN VIEW!!!!!!!!:
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
everything else is the same(minimal req is the first three datasource methods, you don't need the delegate methods) but,
you can't use willdisplaycell its called only for cell based , do everything to the view in the viefortablecolumn method like this:
if ([[tableColumn identifier] isEqualToString:#"YourColumnIdentifier"]){
NSTableCellView *cell = [outlineView makeViewWithIdentifier:#"YourViewsIdentifier" owner:self];
[cell.textField setStringValue:[(YourItem *)item name]];
[cell.imageView setImage:[(YourItem *)item image]];
return cell;
}
return nil;
and don't forget to set identifiers , and to set the OutlineView to be View Based(in IB ...).
Check TableViewPlayground, also View Based NSTableView Basic to Advanced from WWDC 2011.
I've created an NSOutlineView(Sourcelist) in Xcode, given it an outlet, and made my class implement NSOutlineViewDataSource. I then [outlineview setDataSource:], and I see that it creates the cells with the number of items from my array, but they are all blank.
sub1 = [NSArray arrayWithObjects:#"General Data",#"Most Played", #"Misc",#"Log", nil];
sub2 = [NSArray arrayWithObjects:#"General Data", #"Most Played", #"Misc",#"Log", nil];
items = [NSArray arrayWithObjects:sub1,sub2,nil];
[outlin setDataSource:self];
[outlin reloadData];
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
return [self outlineView:outlineView numberOfChildrenOfItem:item] != 0;
}
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
if (item)
if ([item isKindOfClass:[NSArray class]])
return [item count];
else
return 0;
else
return [items count];
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
if (item) {
return [item objectAtIndex:index];
}
else
return [items objectAtIndex:index];
}
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)theColumn byItem:(id)item
{
if (item) {
if ([item isKindOfClass:[NSArray class]])
return #"YES"; // Return name for this node
else
return item;
}
else
return #"List Root";
}
Everything appears to be in order, an it kind of works, except all the text is blank. It creates all the root items and such just without text.
Maybe you forgot to build a table column for your NSOutlineView like this:
NSTableColumn *titleColumn = [[[NSTableColumn alloc] initWithIdentifier:#"identifier"] autorelease];
[[titleColumn headerCell] setStringValue:#"Header"];
[self addTableColumn:titleColumn];
[self setOutlineTableColumn:titleColumn];
Does anyone here know how to make cells in NSOutlineView's editible? Im using the sampe code from apple and I cant seem to get it work at all.
I am trying to set it up so that when you click twice in rapid succession on a cell in the NSOutlineView, the cell becomes editible so the user can update the text inside the cell. (In the same way as it works in xcode, and mail and so on).
I am including most of the rest of the code of this controller in the vain hope someone can spot what I am doing wrong, this is very frustrating. I know shouldEditTableColumn is being called as it is returning the NSLog message upon double click.
#implementation DisplayHierarchyController
- (void)awakeFromNib {
// cache the reused icon images
folderImage = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] retain];
[folderImage setSize:NSMakeSize(16,16)];
objectImage = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericPreferencesIcon)] retain];
[objectImage setSize:NSMakeSize(16,16)];
diagramImage = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericEditionFileIcon)] retain];
[diagramImage setSize:NSMakeSize(16,16)];
//
// Tell the outline view to use a special type of cell
//NSTableColumn *tableColumn = [[outline tableColumns] objectAtIndex: 0];
//ImageTextCell *imageTextCell = [[[ImageTextCell alloc] init] autorelease];
//[imageTextCell setEditable:YES];
//[tableColumn setDataCell:imageTextCell];
//
[[[outline tableColumns] objectAtIndex: 0] setEditable: YES];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item {
NSLog(#"edit %#", tableColumn);
return YES;
}
- (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
ImageTextCell *imageTextCell = [[[ImageTextCell alloc] init] autorelease];
[imageTextCell setEditable:YES];
return imageTextCell;
}
// Returns the object that will be displayed in the tree
- (id)outlineView: (NSOutlineView *)outlineView child: (int)index ofItem: (id)item {
if(item == nil)
return [[document children] objectAtIndex: index];
if([item isKindOfClass: [Item class]])
return [[item children] objectAtIndex: index];
return document;
}
- (BOOL)outlineView: (NSOutlineView *)outlineView isItemExpandable: (id)item {
if([item isKindOfClass: [Item class]])
return [[item children] count]>0;
return NO;
}
- (int)outlineView: (NSOutlineView *)outlineView numberOfChildrenOfItem: (id)item {
if(item == nil)
return document.children.count;
if([item isKindOfClass: [Item class]])
return [[item children] count];
return 0;
}
- (id)outlineView: (NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
if([item isKindOfClass: [Item class]])
return [item name];
return #"n/a";
}
- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
NSLog(#"setObjectValue called");
}
- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
[cell setEditable: YES];
[cell setAllowsEditingTextAttributes: YES];
[(ImageTextCell*)cell setImage: objectImage];
}
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
return YES;
}
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor {
if ([[fieldEditor string] length] == 0) {
// don't allow empty node names
return NO;
} else {
return YES;
}
}
#end
I know this is a very old post, but if any one is experiencing the same issue, this may not be an issue related to code. For my case it was an issue related to do with a value set in the XIB itself.
So lets say you've copied all the Apple code, and you've got your NSOutlineView up and running, and some how its still not editable, go to your XIB and set the following setting of the NSTextField of the cell you want to be editable. In my case the behavior setting was set to none by default. Maybe its the same problem for you
Cheers.
Is the column itself set as editable? Ordinarily, you would do this in IB.
Also, have you implemented the outlineView:setObjectValue: method in your data source?
Ive just discovered I can "fake it" by altering the shouldEditTableColumn. Its really not ideal, but it works. After so many hours trying to get it to work, at least this is something:
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item {
NSLog(#"edit %#", tableColumn);
[outline editColumn:0 row:[outline selectedRow] withEvent:[NSApp currentEvent] select:YES];
return YES;
}
I found a way around this. Set the data cell for the column in IB (programmatically in awakeFromNib should work too). I actually use 2 different custom cell classes. My solution:
NSCell *cell = [tableColumn dataCellForRow: [outlineView rowForItem: item]];
if ([item isKindOfClass: [NSString class]])
return [[[ShadowTextCell alloc] initTextCell: [cell stringValue]] autorelease];
return cell;