Hallo everyone When I embed an NSTableView in an NScrollView, everything works except column auto-resizing.
What would trigger automatic column layout whenever the NSScrollView frame is reduced in size? I have a custom view that creates a NSScrollView and NSTableView: - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { tableView = [[MyTableView alloc] init]; scrollView = [[NSScrollView alloc] initWithFrame:frame]; [tableView setAllowsEmptySelection:YES]; [tableView setAllowsMultipleSelection:YES]; [tableView setFocusRingType:NSFocusRingTypeNone]; [tableView setAllowsColumnResizing:NSTableViewUniformColumnAutoresizingStyle]; [tableView addTableColumn:[self columnWithIdentifier:@"symbol "andTitle:@"Symbol"]]; [tableView addTableColumn:[self columnWithIdentifier:@"shares" andTitle:@"Shares"]]; [tableView addTableColumn:[self columnWithIdentifier:@"quote" andTitle:@"Quote"]]; [tableView addTableColumn:[self columnWithIdentifier:@"commissions" andTitle:@"Commissions"]]; [tableView addTableColumn:[self columnWithIdentifier:@"taxes" andTitle:@"Taxes"]]; [tableView addTableColumn:[self columnWithIdentifier:@"total" andTitle:@"Total"]]; [scrollView setHasVerticalScroller:YES]; [scrollView setHasHorizontalScroller:YES]; [scrollView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; [scrollView setDocumentView:tableView]; [self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; [self addSubview:scrollView]; [scrollView release]; [tableView release]; } return self; } As you can see, the NSScrollView is a subview of my custom NSView. It auto-resizes and has its documentView set to the NSTableView. I omitted the column creation code, but it does something along these lines: [tableColumn setWidth:250.0f]; [tableColumn setMinWidth:100.0f]; [tableColumn setMaxWidth:500.0f]; [tableColumn setResizingMask:NSTableColumnAutoresizingMask|NSTableColumnUserResizingMask]; [tableColumn setDataCell:dataCell]; [tableColumn setHeaderCell:headerCell]; The columns are indeed resizeable, contain a valid headerCell and dataCell. As I said, everything is fine, but the columns do not auto-resize. Thanks a lot, Patrick PS: I will created a sample project if anyone wants me to, but if you copy the NSView's code into a newly created project with a custom view, you are nearly done. _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com