two way bindings?

  • Hi,

    Help! I can't properly get bindings from a custom view to work...

    I have a custom audio sample view with a selection and a cursor. I
    bind these to keys in the selected object of an array controller. A
    table view is also connected to this array controller displaying all
    the entries. Now when I add entries to the table they get commited to
    the array controller and also the audio view updates when I change the
    values, but when I change the selection or the cursor in the view with
    the mouse, this does not get commited to the currently selected row in
    the table as it should. In turn if I use an NSSlider instead of my
    view communication works both ways, as expected. Now the relevant keys
    of the sample notify changes manually with willChange and didChange.
    Also mltiple changes are nested properly and I also properly overload
    automaticallyNotifiesObserversForKey (as documented anyway). Are there
    any further pitfalls I need to be aware of?

    Best

    Daniel
  • On Jan 10, 2008, at 2:53 PM, Daniel Oberhoff wrote:

    > I have a custom audio sample view with a selection and a cursor. I
    > bind these to keys in the selected object of an array controller. A
    > table view is also connected to this array controller displaying all
    > the entries. Now when I add entries to the table they get commited
    > to the array controller and also the audio view updates when I
    > change the values, but when I change the selection or the cursor in
    > the view with the mouse, this does not get commited to the currently
    > selected row in the table as it should.
    >
    Are you updating the selection in the array controller?
    See GraphicsBindings at <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html> for an example that works.

    mmalc
  • Ok, that helped a bit. Now I just record all the bindings and manually
    notify them of my changes. Still beats me why this is neccessary. And
    actually in a simpler example it works, i.e. the willChange... and
    didChange... push the changes through the bindings, just not in my
    view. Well, I probably messed up somewhere down the line. These
    automatic things are sooo fragile. Well, anhow, thanks for that piece
    of inspiring code.

    Best

    Daniel

    Am 11.01.2008 um 00:04 schrieb mmalc crawford:

    >
    > On Jan 10, 2008, at 2:53 PM, Daniel Oberhoff wrote:
    >
    >> I have a custom audio sample view with a selection and a cursor. I
    >> bind these to keys in the selected object of an array controller. A
    >> table view is also connected to this array controller displaying
    >> all the entries. Now when I add entries to the table they get
    >> commited to the array controller and also the audio view updates
    >> when I change the values, but when I change the selection or the
    >> cursor in the view with the mouse, this does not get commited to
    >> the currently selected row in the table as it should.
    >>
    > Are you updating the selection in the array controller?
    > See GraphicsBindings at <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
    > > for an example that works.
    >
    > mmalc
    >
previous month january 2008 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