Re: NSOutlineView selectedRow error?
Re: NSOutlineView selectedRow error?
- Subject: Re: NSOutlineView selectedRow error?
- From: Corbin Dunn <email@hidden>
- Date: Tue, 7 Mar 2006 21:26:11 -0800
On Mar 7, 2006, at 9:23 PM, Corbin Dunn wrote:
When I click the button I placed to draw the template image into my
custom panel, here is the code I use to retrieve the image:
int selectedRow = [templateView selectedRow];
NSImage *ti = [[[templateView tableColumnWithIdentifier:@"Image"]
dataCellForRow:selectedRow] objectValue];
NSLog(@"I think the currently selected row is: %x", selectedRow);
NSLog(@"Image test from Template: %@", ti);
This code is incorrect; you need a little more code, like (typed in
mail):
NSTableColumn *column = [templateView
tableColumnWithIdentifier:@"Image"];
NSCell *cell = [column dataCellForRow:selectedRow];
[cell setObjectValue:[[templateView datasource]
outlineView:templateView objectValueForTableColumn:column
byItem:[templateView itemAtRow:selectedRow]]];
The reason for this is because the same cell is used to "stamp" out
each row.
I should also note that I recommend directly using your model; your
code will be much simpler and easier to understand:
id item = [templateView itemAtRow:[templateView selectedRow]];
NSImage *image = [item image];
---corbin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden