Programmatic binding to Quartz Composition working in one direction

  • I'm sorry if this is a stupid post.  I'm experimenting with Cocoa
    bindings and not fully understanding it.

    I have a Quartz Composer composition with an published input called
    "movieLevelString" (yes, ultimately to show the audio level of a
    playing movie).  I want to bind this to the return value of a method
    in my controller.  I think I have to make this binding
    programmatically, since I can't really "see" either the QC input or my
    controller's method in IB.

    After trying various combinations of Object Controllers and binding
    statements that coughed up "this class is not key value coding-
    compliant for the key" errors at runtime, I found an arrangement that
    kind of works.  My controller has the methods movieLevel and
    setMovieLevel, which trivially manage a _movieLevel NSString.  Then I
    call the following in awakeFromNib:

    [self bind:@"movieLevelString"

    Now here's the part I don't get.  At the top of awakeFromNib, before
    bind:, I set the value "undef'ed".  At the bottom, after binding, I
    try to set it again, this time to "whatever". I never see the string
    "whatever" get displayed in the QCView, but some NSLog statements show
    that the composition's default value for the input, "Hello World!",
    gets sent back to my controller:

    2008-01-20 17:21:08.839 QCLevelMeterExperiment1[1608:10b] awakeFromNib!
    2008-01-20 17:21:08.853 QCLevelMeterExperiment1[1608:10b]
    _movieLevelString now == undef'ed
    2008-01-20 17:21:08.882 QCLevelMeterExperiment1[1608:10b]
    2008-01-20 17:21:08.911 QCLevelMeterExperiment1[1608:10b]
    2008-01-20 17:21:08.912 QCLevelMeterExperiment1[1608:10b]
    _movieLevelString now == Hello World!
    2008-01-20 17:21:08.914 QCLevelMeterExperiment1[1608:10b] Called bind
    2008-01-20 17:21:08.915 QCLevelMeterExperiment1[1608:10b]
    _movieLevelString now == whatever

    So what I don't get is why this binding only seems to work in one
    direction, from the QC patch back to my controller, but not from my
    controller back to QC.  Looking at Aaron Hillegass' book, I wondered
    if I needed to override observeValueForKeyPath, but from what I can
    tell, it isn't being called.

    I assume the problem is me being stupid and getting ahead of myself
    without having a deep and profound understanding of Cocoa bindings.
    So what does it take for my sets to get reflected in QC?

previous month january 2008 next month
  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