Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have 4 InputFields.I want to find which InputField was recently Updated out of all InputFields.For that purpose I wrote the following code.

 fValues = {Null, Null, Null, Null};
 {
  Table[
    With[
        {i = i},
        (
                InputField[
                            Dynamic[Part[fValues, i]],
                            Number,
                            ContinuousAction -> True
                        ]
            )
        ],
    {i, 1, 4}
],
Dynamic[fValues]
}

How can I resolve this?

Can anyone help me?

Thank you

share|improve this question
    
Could you please tell us why do you keep using so much whitespace with your code formatting? I am simply curious. –  István Zachar May 2 '13 at 11:24
    
@IstvánZachar For my code maintenance and understanding purpose,every time I following indentation Styels. –  subbu May 2 '13 at 11:42
add comment

1 Answer 1

up vote 2 down vote accepted

You can use the second argument to Dynamic:

DynamicModule[{fValues, msg, processChanges},
 fValues = {Null, Null, Null, Null};
 msg = "No change yet";
 processChanges[field_, oldvalue_, newvalue_] := 
  msg = Row[{field, " was changed from ", oldvalue, " to ", newvalue}];

 {Table[With[{i = i}, (InputField[
      Dynamic[Part[fValues, i], processChanges[i, fValues[[i]], fValues[[i]] = #] &],
      Number, ContinuousAction -> True])], {i, 1, 4}],
  Dynamic[fValues], 
  Dynamic[msg]}
 ]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.