But it took me quite some time to realize that the change of the value was due to the returning to the previous value when the mouse is released. So, mouseDownAction sets it to 0, but then on mouseUpAction a new value being set. So, changing it to mouseUpAction removed the necessity of deferring:
(
var window = Window("Cmd+Click Test", 200@200).front;
var knob = EZKnob(window, 100@150, "Test", [-1.0, 1.0].asSpec,
action: { |ez| postf("set to %\n", ez.value) },
initValue: 0.0
);
// Using mouseUpAction prevents returning to the previous value when the mouse is released
knob.knobView.mouseUpAction = { |view, x, y, modifiers, buttonNumber, clickCount|
if ((modifiers == 262144) and: (buttonNumber == 1)) {
knob.valueAction = 0.0
};
};
)