Accessing NSTableView bindings' datasource

  • Hi,

    I have a custom NSTableView subclass that need to access the
    datasource to
    precalculate a grid in -tile

    Now if I use an old datasource I can obtain the values with
    -tableView:objectValueForTableColumn:row: but how can I access these
    values if
    the contents is provided with 'value' tablecolumn binding? (with 10.3
    and up)

    If I a subclass NSTableColumn I can intercept -
    bind:toObject:withKeyPath:options:
    and cache the object/keypath but I need a way to do it without
    subclassing...

    Thank you.

    Ciao
    Mirko
  • Send the NSTableColumn an infoForBinding: message asking for its
    NSValueBinding binding. In the dictionary returned, the value of
    NSObservedObjectKey entry will be the bound value object.

    Greg

    On 3/19/06 3:05 PM, "Mirko Viviani" <mirko...> wrote:

    > Hi,
    >
    > I have a custom NSTableView subclass that need to access the
    > datasource to
    > precalculate a grid in -tile
    >
    > Now if I use an old datasource I can obtain the values with
    > -tableView:objectValueForTableColumn:row: but how can I access these
    > values if
    > the contents is provided with 'value' tablecolumn binding? (with 10.3
    > and up)
    >
    > If I a subclass NSTableColumn I can intercept -
    > bind:toObject:withKeyPath:options:
    > and cache the object/keypath but I need a way to do it without
    > subclassing...
    >
    > Thank you.
    >
    > Ciao
    > Mirko
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<greghe...>
    >
    > This email sent to <greghe...>
  • On Mar 19, 2006, at 3:05 PM, Mirko Viviani wrote:

    > but how can I access these values if the contents is provided with
    > 'value' tablecolumn binding? (with 10.3 and up)
    > If I a subclass NSTableColumn I can intercept -
    > bind:toObject:withKeyPath:options:
    > and cache the object/keypath but I need a way to do it without
    > subclassing...

    On 10.3 and later, there isn't a way.  infoForBinding is only
    available on 10.4 and later:
    <http://developer.apple.com/documentation/Cocoa/Reference/
    ApplicationKit/Objc_classic/Protocols/
    NSKeyValueBindingCreation.html#//apple_ref/occ/instm/NSObject/
    infoForBinding:
    >.

    mmalc
previous month march 2006 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today