Re: NSCell and IB
Re: NSCell and IB
- Subject: Re: NSCell and IB
- From: Enrique Zamudio <email@hidden>
- Date: Mon, 17 Sep 2001 20:05:53 -0500
- Organization: Nasoft
I think you can still use a tableview. You have to set it up so that it
does not allow column selection, column reordering, and the columns must
not be editable. Then, programatically, you can:
1) set the height of the rows (I'm not sure if you can do this with a
setRowHeight: method or something similar, or if you have to get each
dataCell and set its height separately).
2) make one of the columns use a data cell that displays an image
instead of text.
3) configure the other two data cells so that the text will wrap instead
of just cropping it.
That way, your tableview will have taller rows (you'll have to fine-tune
it to make the rows as high as two rows of text each), you will be able
to display an image in one of the columns, and the text columns will
have two lines of text each.
Regarding the image cell: perhaps you can just use a NSImageCell but
maybe you'll want to use something else, that's up to you. you have to
set it programatically, I think there's a setDataCell: method to let you
replace the data cell that's used in a NSTableColumn. You can also
replace the header cells if you need to.
So, maybe you can still use a tableview and have it roughly set up from
IB and then configure the rest of it programatically. It's better than
having to write your own subclass of NSCell, since that will require you
to handle all the drawing (composite the image, write the text in a
rectangle, then the other text in another rectangle, calculate the
rectangles' sizes, etc). There's no way (that I know of) to set up a
NSCell from IB since that is an abstract class (it's not a view, you
know... a matrix or some other NSControl can use a cell to draw itself,
but it's kind of weird... the cell has the code to draw whatever it's
supposed to represent but that's about it, the NSControl handles the
user input through the keyboard, mouse, etc and send
messages/notifications to its target/observers).
eZL