Bindings and key paths

Discussion in 'Mac Programming' started by AussieSusan, Sep 11, 2008.

  1. macrumors member

    Joined:
    May 29, 2006
    Location:
    Melbourne, Australia
    #1
    I have a 'usual' arrangement of a NSTableView that is bound to an NSArrayController which in turn is bound to a KVC compliant controller class which all works nicely.

    I have another form (separate nib) that has an NSPopupButton that is bound to its own array controller that contains a key path through its own controller class to the same controller class as above.

    (Basically, the first arrangement above is used to maintain a table of valid values which is used as the 'popup' values in the second form).

    My problem is that the data is not populated (using the first arrangement above) until after the controls are all displayed on the screen. Therefore the first access of the data by the popup button sees an empty table.

    The initial entry of the data (from the 'model' which is an external device in this case) occurs in a KVC-compliant manner and updates the table nicely. However, the popup button does not see the updates and so ends up with an empty popup list. Nor does it see any of the subsequent manual adjustments that are made to the table.

    I thought that the KVO part of the binding through a path (with several 'steps') should be able to detect the changes in the same way as the more direct access.

    Have I missed some critical item somewhere? Can anyone suggest how to get my popup list to be updated as changes are made in the other view/controller combination?

    Thanks

    Susan

    (OS X 10.5.4, XCode 3.1)
     
  2. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    Have you tried wrapping the access of the object that's not sending KVO notifications in willChangeValueForKey: and didChangeValueForKey: calls? Without seeing the code it's a little hard to understand exactly...
     
  3. thread starter macrumors member

    Joined:
    May 29, 2006
    Location:
    Melbourne, Australia
    #3
    HiRez,

    Thank you for responding - actually turned out to be a (very stupid) error on my part.

    Susan
     

Share This Page