Setting the controlSize for an NSTextFieldCell doesn't do anything (as far as I know). You probably want to make the font size small to really see a change. Please log a bug requesting -setControlSize to do this for you automatically. I believe IB sets the font for you when this is changed there.

corbin

On Sep 13, 2009, at 6:57 PM, BareFeet wrote:

Hi all,

I'm programmatically building an NSTable. I add columns in a loop and am trying to set various attributes. All of it works except setControlSize:NSSmallControlSize. When I get the value after setting (ie using controlSize), it seems to have changed, but the actual cell/column is still shown in regular size (even after initiating a view update). What am I missing?

Sample code:

//  BFTableViewCategory.h

#import <Cocoa/Cocoa.h>

@interface NSTableView (ExtrasByTom)

- (void) createColumns:(NSArray*)dataColumns;

@end


#import "BFTableViewCategory.h"

@implementation NSTableView (ExtrasByTom)

- (void) createColumns:(NSArray*)dataColumns {
        for (NSString* columnName in columnNames) {
NSTableColumn* newTableColumn = [[[NSTableColumn alloc] initWithIdentifier:columnName] autorelease];
                [[newTableColumn headerCell] setStringValue:columnName];
                [self addTableColumn:newTableColumn];
                [[newTableColumn dataCell] setAlignment:NSRightTextAlignment];
[[newTableColumn dataCell] setControlSize:NSSmallControlSize]; // only thing that doesn't show change
                [newTableColumn setWidth:100];
        }
}

Thanks,
Tom
BareFeet


_______________________________________________

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

Reply via email to