Re: cocoa-dev digest, Vol 1 #277 - 14 msgs
Re: cocoa-dev digest, Vol 1 #277 - 14 msgs
- Subject: Re: cocoa-dev digest, Vol 1 #277 - 14 msgs
- From: Shin Yamamoto <email@hidden>
- Date: Fri, 13 Jul 2001 10:22:37 +0900
On Thu, 12 Jul 200, at 19:07:47 -0500, Nathan V. Roberts wrote:
I'm trying (mainly for printing purposes) to get my NSTableView to
display all data within the column, rather than truncating it. (So,
e.g., if it takes 3 lines to display the last column for a given row,
that row will be 3 lines tall.)
If you don't mind that every row in your table has the same hight, you
may not need to subclass the NSTableView. This is what I did for my app.
In your data source or delegate for the table view, you need to get an
object of NSTableColumn first. Assuming you name it as 'column' in your
implementation, the following snippet sets the height of row and makes
the content wrap:
NSRect boundingRect;
boundingRect = [[[column dataCell] font] boundingRectForFont];
[tableView setRowHeight:boundingRect.size.height * height];
[[column dataCell] setWraps:YES];
where tableView is an instance of NSTableView and height is the desired
row height in lines, e.g. 1.0, 1.5, 3.0 and so on. This code also
assumes the dataCell to be a text cell.
-shin