On Mac OS X, look for NSTableViewDelegate tableView:heightOfRow:. The width is set through the NSTableColumn which has an entire set of methods to set the minimum width, the width and the maximum width.
-Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/ Logiciels Nemesys Software laur...@nemesys-soft.com On Jul 11, 2012, at 15:06, TJ <tob...@tool-forcesw.com> wrote: > Hey guys, > > I'm trying to replace my old cell-based NSTableView system with the new 10.7+ > view-based one without using Xcode's Interface Builder for the table view and > column creation. > What I am doing now is creating an NSTableCellView inside NSTableView's > delegate method [-NSTableView tableView:viewForTableColumn:row:]: > > - (NSView *)tableView:(NSOutlineView *)aTableView > viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row > { > NSString *identifier = [tableColumn identifier]; > NSString *stringValue = [self tableView:aTableView > objectValueForTableColumn:tableColumn row:row]; > NSTableCellView *cellView = [aTableView > makeViewWithIdentifier:identifier owner:self]; > if (cellView == nil) > { > // Create cell view > cellView = [[[NSTableCellView alloc] initWithFrame:[cellView > frame]] autorelease]; > cellView.identifier = identifier; > // Create text field > NSTextField *textField = [[[NSTextField alloc] > initWithFrame:[cellView frame]] autorelease]; > [textField setIdentifier:identifier]; > [textField setBordered:NO]; > [textField setDrawsBackground:NO]; > [textField setStringValue: stringValue]; > cellView.textField = textField; > [cellView addSubview:textField]; > return cellView: > } > > [cellView.textField stringValue]; > return cellView; > } > > The problem here is that I don't have any idea where and how to get and set > the frame of the cell. As you can see during the creation of NSTableCellView > I'm basically using an NSZeroRect because [cellView frame] is nil. I > subclassed NSTableCellView and added a red color for the background in order > to see if the NSZeroRect gets automatically updated to the current cell rect > - it does work. But it just doesn't make sense to create a subview of > NSTableCellView with a zero-frame... is there a method inside NSTableCellView > I should subclass and position the NSTextField? Or is it common to get the > frame inside -viewForTableColumn and adjusting the text field there? What's > the way Apple had in mind concerning programmatically creating a view-based > NSTableView? I couldn't find a lot of information on this, the demo video on > developer.apple.com directly uses an NSTextField as the return cell-view but > my view needs to be more complex than that. I am pretty sure I just missed > something very important here. ;-) And my second question is - is it possible > to create a cell view which is bigger than one row, thus it's overlaying > other rows (I'm not customizing my table view to death, I have a good reason > for cell views being positioned over several rows). _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com