Triggering NSTextView changes and bindings

  • I've got an NSTextView whose attributeValue is bound to a core-data object.

    I've got a menu item which programmatically modifies the NSTextView's contents.

    The programmatic changes don't trigger a modification to the underlying object unless the user tabs to and exits the NSTextView manually.

    What is the correct way, when programmatically modifying an NSTextView, to make sure the system propagates changes to underlying bindings?

          Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more
  • On Sun, Feb 1, 2009 at 11:45 AM, Chris Idou <idou747...> wrote:
    > I've got an NSTextView whose attributeValue is bound to a core-data object.
    >
    > I've got a menu item which programmatically modifies the NSTextView's contents.
    >
    > The programmatic changes don't trigger a modification to the underlying object unless the user tabs to and exits the NSTextView manually.
    >
    > What is the correct way, when programmatically modifying an NSTextView, to make sure the system propagates changes to underlying bindings?

    The correct way is not to do it in the first place.

    Views are there for the user to modify, not for your program to
    modify. Bindings are two-directional: your program should change the
    *model*, and then the binding will ensure that the NSTextView matches
    that change.

    Mike