ComboBox result delayed

Hello,
I’m using several combo boxes in my app. One of them behaves differently, but I don’t know why.

I made my app the delegate of this combo, bind a property list of value as “content value”, and another property, gFormNumber, as “value”. Then I test a new entry in two way, depending of the notification:

If the user types a value, all is updated immediately and correctly:

on controlTextDidChange_(aNotification)
if aNotification's object is gFormNumberCtrl then
log gFormNumber
end if
end

logs the typing character by character and updates the value. Fine. But if the user chooses a value by the pop menu:

on comboBoxSelectionDidChange_(aNotification)
log gFormNumber
end

does log the previous value of gFormNumber, even if the text box shows the newly chosen value.

I have forgotten something, but what? I look again and again, comparing with other (working) combo boxes, and can’t find what.

Thank you,

Validates immediately?

Is on.

I’m beginning to test everything. has the AS {list} that I bind to the “Control value” to be completed by a nil, i.e. {“10”, "15, “20”, “30”, missing value}?

Curses. No.

Try this:

on comboBoxSelectionDidChange_(aNotification)
    set gFormNumber to aNotification's object's objectValueOfSelectedItem()
    log gFormNumber
end

Ric

Working but. why am I supposed to do the work of the KVO? And why in one case and not in another?

EDIT: Ok, I found this:

in the Setting the Combo Box’s Value section of the System Guide. So Menu and Text Field are not so closely linked.

Well, this does explain the non-working combo. The working ones must be just favorably disposed toward me :confused:

Thanks, Ric!

I think the problem is that when you select from the list it populates the text field part of the combo box, but it’s still highlighted – that is, it hasn’t given up first responder status yet. If you pick from the list and then push tab or return, then the right value shows up. It doesn’t seem like the best way for the control to operate, but it is what it is.

Ric

Right – and that is, a fancy text field, not a menu. When you think of it that way, the behaviour makes a little more sense.