• 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: Manual Binding in NSTableColumn
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual Binding in NSTableColumn


  • Subject: Re: Manual Binding in NSTableColumn
  • From: mmalcolm crawford <email@hidden>
  • Date: Tue, 6 Jan 2004 15:35:58 -0800

On Jan 6, 2004, at 2:37 PM, Jonathan Wight wrote:

But the Manual Bindings sample code you provide binds a controller to a NSTableColumn that has been created in Interface Builder.

That shouldn't make any difference -- see below.

I'm trying to bind with a NSTableColumn that I create programatically. I added a logging to your sample code to log the exposed bindings of your NSTableColumn and I got this:
( fontSize, maxValue, fontName, minWidth, fontFamilyName, minValue, font, fontItalic, headerTitle, textColor, value, editable, maxWidth, width, fontBold )
That's dramatically different from the set of bindings I get from a programatically created NSTableHeader:
( fontSize, fontName, minWidth, fontFamilyName, headerTitle, font, fontItalic, editable, maxWidth, width, fontBold )
Am I missing something?

I added a formatter to my table column. And I'm not sure why you're comparing with NSTableHeader?

Here's some code to add a new table column with bindings:

- (void)addTableColumnWithIdentifier:(NSString *)ident
{

NSTableColumn *newColumn = [[NSTableColumn alloc] initWithIdentifier:ident];
[tableview addTableColumn:newColumn];
[newColumn release];

[[newColumn headerCell] setTitle:
NSLocalizedStringFromTable(ident, @"TableHeaders", nil)];
[[newColumn dataCell] setDrawsBackground:NO];

if (...)
{
NSNumberFormatter *numberFormatter =
[[[NSNumberFormatter alloc] init] autorelease];
[numberFormatter setFormat:@"$#,##0.00"];
[[newColumn dataCell] setFormatter:numberFormatter];
[[newColumn dataCell] setAlignment:NSRightTextAlignment];
}

NSMutableDictionary *bindingOptions=[NSMutableDictionary dictionary];
[bindingOptions setObject:[NSNumber numberWithBool:YES]
forKey:NSValidatesImmediatelyOption];
// ...
NSString *keyPath = [NSString stringWithFormat:@"arrangedObjects.%@", ident];
[newColumn bind: @"value" toObject: productArrayController
withKeyPath:keyPath options:bindingOptions];
}


mmalc
_______________________________________________
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: 
 >Manual Binding in NSTableColumn (From: Jonathan Wight <email@hidden>)
 >Re: Manual Binding in NSTableColumn (From: mmalcolm crawford <email@hidden>)
 >Re: Manual Binding in NSTableColumn (From: Jonathan Wight <email@hidden>)

  • Prev by Date: Make iCal Reload Via AppleScript
  • Next by Date: Re: NSValidatesImmediatelyOption (was: Re: Manual Binding in NSTableColumn)
  • Previous by thread: Re: Manual Binding in NSTableColumn
  • Next by thread: Re: Manual Binding in NSTableColumn
  • Index(es):
    • Date
    • Thread