Skip navigation.
 
mlRe: How to attach a formatter with a NSTableColumn
FROM : Scot Gellock
DATE : Mon Nov 18 16:29:28 2002

On 11/17/02 11:52 AM, "Rakesh Pandey" <<email_removed>> 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_removed>
> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlHow to attach a formatter with a NSTableColumn Rakesh Pandey Nov 17, 20:52
mlRe: How to attach a formatter with a NSTableColumn Scot Gellock Nov 18, 16:29