Re: NSOutlineView, NSBrowserCell and Images
Re: NSOutlineView, NSBrowserCell and Images
- Subject: Re: NSOutlineView, NSBrowserCell and Images
- From: Brian Bergstrand <email@hidden>
- Date: Wed, 26 May 2004 15:07:46 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
That explains what is happening, and my guess. I chose it because it
seemed like the easiest way to get an icon/text cell, but maybe
NSImageCell is better? Of course if each column shares a cell, then
that probably won't work either.
What would be the best way to do this? Basically, I want a view like
Disk Utility offers -- separate text and images for each row. It looks
like an NSOutlineView, but maybe it's something custom.
Thanks for the quick answer, any further help would be appreciated too.
On May 26, 2004, at 2:04 PM, John Randolph wrote:
>
Brian,
>
>
NSOutlineView, like NSTableView, has exactly one cell per column,
>
which is re-used to draw each row. Why did you choose NSBrowserCell
>
for this?
>
>
-jcr
>
>
>
On May 26, 2004, at 9:18 AM, Brian Bergstrand wrote:
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
>
> Hash: SHA1
>
>
>
> I posted this on Mac OS X Dev a few days ago, and received no
>
> response.
>
> Can anyone here help?
>
>
>
> Thanks.
>
>
>
> Begin forwarded message:
>
>>
>
>> Hi all,
>
>>
>
>> I have an Outline view that uses NSBrowserCell as the cell
>
>> prototype. I
>
>> have one problem with this, it seems as though the outline view is
>
>> sharing a single cell -- at least for the image portion of the cell.
>
>> All of my entries end up sharing the same icon, when they should have
>
>> different icons. The entry names as correct (ie not shared), but the
>
>> icons are not.
>
>>
>
>> I set the table up as follows in my init method:
>
>>
>
>> [[outline tableColumnWithIdentifier:@"col1"]
>
>> setDataCell:[[[NSBrowserCell alloc] init] autorelease]];
>
>>
>
>> And then in the willDisplayCell delegate method, I set the icon for
>
>> each item.
>
>>
>
>> - - (void)outlineView:(NSOutlineView *)outlineView
>
>> willDisplayCell:(id)cell
>
>> forTableColumn:(NSTableColumn *)tableColumn item:(id)item
>
>> {
>
>> // determine correct icon
>
>> [cell setImage:icon];
>
>> //
>
>> }
>
>>
>
>> This works the first time through, but as soon as the view needs to
>
>> redraw items, all cells change to the icon of the very last cell set.
>
>>
>
>> Anyone have any ideas?
>
>>
>
>> Thanks.
>
Brian Bergstrand <
http://www.bergstrand.org/brian/>, AIM: triryche206
PGP Key: <
http://www.bergstrand.org/brian/misc/public_key.txt>
Fools rush in where fools have been before. - Unknown
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQLTrB3nR2Fu2x7aiEQKFqwCgjcq9siUi0XqmVek7kEgVcpVS1PoAoPuj
PasIB9i6YTDsjc+dz16dRcM0
=BDz+
-----END PGP SIGNATURE-----
_______________________________________________
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.