Many years ago, I made a handy little program in Flash.
It consisted of a number of input fields, each representing a variable that was dependent on all the others. As soon as any field changed, the other followed, no matter which of them I changed.
So they where effectively both in- and output fields.
A simple algorithm kept track of which field would output the result, (usually the one which had experienced no change or with oldest edit).
EDIT: Only one variable is calculated each time a value is changed.
It may be partly exemplified by the following code. However, in this case only the last InputField "c-variable" is calculated, while the goal is to arbitrarily be able to chose which is to be calculated. The latter can be achieved either by a checkbox or algorithmically.
Clear[a, b, c]; Row[{Labeled[
InputField[Dynamic[a], Number, ContinuousAction -> True,
FieldSize -> Tiny], "a-variable", Top],
Labeled[InputField[Dynamic[b], Number, ContinuousAction -> True,
FieldSize -> Tiny], "b-variable", Top],
Labeled[InputField[N@Dynamic[c = (a*b)/2], Number,
ContinuousAction -> True, FieldSize -> Tiny], "c-variable", Top]}]
So my question:
Is there a simple way of programmatically switching the properties as to make any arbitrary field an output field?
Another question comes into mind: The exemplified InputFields above can't handle backspace. To change the first digit one has to double-click. How could this be accomplished?
EDIT 2: I have answered some of the points in my answer below.
Comments
Post a Comment