Re: How to attach a formatter with a NSTableColumn
Re: How to attach a formatter with a NSTableColumn
- Subject: Re: How to attach a formatter with a NSTableColumn
- From: Scot Gellock <email@hidden>
- Date: Mon, 18 Nov 2002 07:29:28 -0800
On 11/17/02 11:52 AM, "Rakesh Pandey" <email@hidden> wrote:
>
Hi All,
>
>
I have to attach a custome Formatter with an NSTableColun programatticaly,
>
Please tell me how to do it.
>
>
Regards
>
Rakesh
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
I have the following code that I call from my document's
windowControllerDidLoadNib:
- (void)setDirectoryViewNumberFormatters:(NSTableView *)tableView
{
NSTableColumn *tc;
NSCell *cell;
NSNumberFormatter *formatter;
// see if what we were passed in was reasonable
NSParameterAssert(tableView != nil);
if(tableView == nil)
return;
// configure the tableView's NSCells for the appropriate formatting
tc = [tableView tableColumnWithIdentifier:@"size"];
NSAssert(tc != nil, @"invalid table view. can't find \'size\' column");
if(tc == nil)
return;
cell = [tc dataCell];
formatter = [[[NSNumberFormatter alloc] init] autorelease];
[formatter setLocalizesFormat:YES];
[formatter setFormat:@"0"];
[formatter setHasThousandSeparators:YES];
[cell setFormatter:formatter];
}
Scot
http://homepage.mac.com/scotgellock
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.