Re: Buttons with images in NSTableView
Re: Buttons with images in NSTableView
- Subject: Re: Buttons with images in NSTableView
- From: Ricky Sharp <email@hidden>
- Date: Tue, 23 Nov 2004 06:05:53 -0600
On Tuesday, November 23, 2004, at 04:59AM, Duncan Bushell <email@hidden> wrote:
>Yes, this would work but I can see no way to get hold of the NSButtonCell's
>id from the NSTableView so have nowhere to call setImage: I guess the
>problem is that NSTableView does not in fact have a separate cell for each
>row, but just reuses the same one?
It's true that the same cell is reused, but check out this API:
tableView:willDisplayCell:forTableColumn:row:
Here's a quote from the docs on it:
"Informs the delegate that aTableView will display the cell at rowIndex in aTableColumn using aCell. The delegate can modify the display attributes of aCell to alter the appearance of the cell. Because aCell is reused for every row in aTableColumn, the delegate must set the display attributes both when drawing special cells and when drawing normal cells."
Just found that API today after I peeked at the /Examples/AppKit/DragNDropOutlineView/ sample code. Check out AppController.m which implements outlineView:willDisplayCell:forTableColumn:item which also provides a "hook" to alter the cell before it displays.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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