• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOutlineView selectedRow error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSOutlineView selectedRow error?
      • From: Scott Harper <email@hidden>
References: 
 >Re: NSOutlineView selectedRow error? (From: Greg Herlihy <email@hidden>)
 >Re: NSOutlineView selectedRow error? (From: Scott Harper <email@hidden>)
 >Re: NSOutlineView selectedRow error? (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: NSOutlineView selectedRow error?
  • Next by Date: Re: NSOutlineView selectedRow error?
  • Previous by thread: Re: NSOutlineView selectedRow error?
  • Next by thread: Re: NSOutlineView selectedRow error?
  • Index(es):
    • Date
    • Thread