How to draw in a tableView cell
How to draw in a tableView cell
- Subject: How to draw in a tableView cell
- From: Denis Stanton <email@hidden>
- Date: Mon, 1 Mar 2004 13:46:49 +1300
Hi
I'm stuck on something and I hope someone can nudge me in the right
direction.
I want to draw coloured rectangles into one column of each row of a
tableView. Similar to constructing a bar graph, except that there will
be multiple rectangles in a cell
I'm having trouble deciding where I should do this, and then how to get
hold of the appropriate rectangle to draw in
I began with some old code for drawing striped table views (now
superseded). In that code I overwrote highlightSelectionInClipRect:
(NSRect)clipRect in a custom tableView
This was fine for putting a coloured background rectangle behind every
second row, but now I want the rectangles to be of different sizes for
each row, so I need to look up some data values using the row index. I
can find the index using rowAtPoint:, and use this to look up the array
that contains the data but the further I get the more I think this is
the wrong place to be writing this code. Instead of hacking at the
highlightSelectionInClipRect method I think I should be working on the
tableView:objectValueForTableColumn:row: method in the Window
Controller, or perhaps the tableView:willDisplayCell:forTableColumn:row
method. Is this the right place?
If I'm going to work in the cell I will need to know its rect. There
seems to be a method for getting this in [cell frame], but when I try
this I get *** -[NSTextFieldCell frame] selector not recognized
So should I define the cell to be something other than an
NSTextFieldCell ? Which brings me to the question - How to I set a
cell's type in InterFace Builder? I can set attributes for the
tableView and tableColumn but I can't find any way to select the cell.
Denis
Denis Stanton
email@hidden
Home: +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
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.