Thanks for sharing the adapter. I just have a couple of suggestions.
You wrote your addition right on the code of an existing adapter. This can cause a problem, because the interfaces of an adapter (i.e., the names of properties and methods) may be preserved during updates but the code lines are not. If the adapter that your work was based on is rewritten in a new ML version, your adapter may become incompatible. Indeed, SingleTarget has been changed a couple of times already from the version you used. The better practice is to inherit the interfaces of SingleTarget rather than copy its code.
I think some codes are redundant in your implementation and can be simplified. For example, WaitForChange and ChangeVal can be combined into one variable that indicates both value change and value amount. Also, a new fix window graphic is created automatically when a new value is assigned to the Threshold property, so many graphic-related codes you added are not necessary.
I tried modifying your adapter. Please take a look at the attached file. The hotkey definitions need to be changed like the following.
hotkey('i', "fix1.ChangeVal = change_step;");
hotkey('o', "fix1.ChangeVal = -change_step;");
change_step = 1.05;
editable('change_step');
Attachments:
open |
download -
ChangeableSingleTarget.m
(718 bytes)