• 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: Displaying images in an outline view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying images in an outline view


  • Subject: Re: Displaying images in an outline view
  • From: Dave Thorup <email@hidden>
  • Date: Wed, 30 Apr 2003 10:53:03 -0600

On 4/30/03 10:12 AM, "Roberto Esposito" <email@hidden> wrote:

> Dear list,
> I'm trying to display an image inside an outline view. I guess it is
> possible since from in the developer docs I found the following
> encouraging statement:
>
> "The data cell for the column values is typically an instance of
> NSTextFieldCell, but can be an instance of any NSCell subclass, such as
> NSImageCell. "
>
> Actually the docs are talking about NSTableView, but since the former
> is a subclass of the latter I guessed that they apply to NSOutlineView
> too.
>
> I'm actually without any clue. I tried by returning an NSImage and an
> NSImageCell in the
>
> - (id)outlineView:(NSOutlineView *)outlineView
> objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
>
> but without any luck. The only effect is to display the string returned
> by the description method of those objects.

You need to change the data cell for the column you want the images in.
Look at the docs for NSTableColumn's setDataCell: method:

- (void)setDataCell:(NSCell *)aCell

Sets the NSCell used by the NSTableView to draw individual values for the
receiver to aCell. You can use this method to control the font, alignment,
and other text attributes for an NSTableColumn. You can also assign a cell
to display things other than text-for example, an NSImageCell to display
images.

So in your initialization code you'd need to get the NSTableColumn you want
the images in:

NSTableColumn* tableColumn=[outlineView
tableColumnWithIdentifier:@"your identifier"];

Then set the column's data cell to be an NSImageCell:

[tableColumn setDataCell:[[NSImageCell alloc] initImageCell:nil]];

Now you use the data source method
"outlineView:objectValueForTableColumn:byItem:" to return the proper
NSImage.

I hope this helps.

Note: Be sure to check the code since I haven't checked it myself.

____________________________________

Dave Thorup
Software Engineer
email@hidden
voice: 801-805-9422

www.corda.com
Interactive data driven graphics.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Displaying images in an outline view (From: Roberto Esposito <email@hidden>)

  • Prev by Date: Displaying images in an outline view
  • Next by Date: Re: Include arbitrary dylib in project
  • Previous by thread: Displaying images in an outline view
  • Next by thread: Re: remove alpha channel from bitmap
  • Index(es):
    • Date
    • Thread