• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to attach a formatter with a NSTableColumn
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >How to attach a formatter with a NSTableColumn (From: Rakesh Pandey <email@hidden>)

  • Prev by Date: Making a "shaped" NSImage
  • Next by Date: Re: [OT] jobs?
  • Previous by thread: How to attach a formatter with a NSTableColumn
  • Next by thread: [repost] System Config Framework - is this legal?
  • Index(es):
    • Date
    • Thread