0
$\begingroup$

What is wrong with the following code?

  Panel[DynamicModule[{a = RandomInteger[100], b = RandomInteger[100],
   f = a + b}, 
  Column[{InputField[{Dynamic[a], Dynamic[b]}], Dynamic[f]}]]]

Once executed the values in the panel cannot be changed.

Thank you.

$\endgroup$

1 Answer 1

1
$\begingroup$

Work with lists:

Panel[
 DynamicModule[{a = {RandomInteger[100], RandomInteger[100]}},
  Column[{InputField[Dynamic[a]], Dynamic[Total@a]}]]]

or

DynamicModule[{b = {RandomInteger[100], RandomInteger[100]}},
 Panel[Column[{InputField[Dynamic[b]], Dynamic[Total@b]}]]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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