NSTokenField: "value" binding hijacks down-arrow key

  • • "value" binding of an NSTokenField bound is bound via an object controller to an array property of a model object.
    • -tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: is implemented to show completions.

    The completions menu shows, but when user hits the down-arrow key, instead of stepping into the completions menu, the token ends editing immediately, setting its value to the first completion in the menu.

    Problem seems to be related to the "value" binding, because without this binding the down-arrow key steps into the completions menu as expected.  Works the same with or without the binding options (No Selection, Multiple Values, etc.).  Also works the same with either binding in Interface Builder or in code.

    I've been pounding on this for several hours.  Any ideas?

    Thanks,

    Jerry Krinock
  • On 2012 Jul 18, at 09:12, Jerry Krinock wrote:

    > • "value" binding of an NSTokenField bound is bound via an object controller to an array property of a model object.
    > • -tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: is implemented to show completions.
    >
    > The completions menu shows, but when user hits the down-arrow key, instead of stepping into the completions menu, the token ends editing immediately, setting its value to the first completion in the menu.
    >
    > Problem seems to be related to the "value" binding, because without this binding the down-arrow key steps into the completions menu as expected.  Works the same with or without the binding options (No Selection, Multiple Values, etc.).  Also works the same with either binding in Interface Builder or in code.

    For some reason, if I implement a cheesy "helper" attribute in the window controller, and bind the token field's "value" to this, bypassing the object controller, the problem is solved.

    I tried to reproduce the problem in a small test project, but its completions menu always works as expected, with or without the object controller.  The explanation may be that, in the real project, the binding is to a special "multi-object" object which I have designed to merge attributes for multiple selections, via -(set)valueForUndefinedKey:.

    But all this trouble is in 10.7, and with 10.8 on the way, the boss says I should ship with the cheesy "helper" attribute workaround and move on.  Sorry :)
previous month july 2012 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