Skip to main content
2 of 2
Enhancements in code of MWE
Vicent
  • 1.1k
  • 6
  • 16

I played around with the code and I finally found a way to do what I wanted. In the meanwhile, I think I've also better understood the behaviour of Manipulate.

This is my solution; it deals with the second MWE I posted:

Manipulate[

 (* === Calculations that are triggered each time there is a change
        in tracked symbols —'parameters', in this case: === *)

 message = "Updating..."; result = "";
 Pause[2];
 result = parameters[[1]] + parameters[[2]];
 message = "Ready";

 (* === Results to be shown: === *)

 Column[{Dynamic[message], Dynamic[result]}],

 (* === Controls: === *)

 {{a, 5}, 0, 10, 1, Appearance -> {"Labeled"}, AppearanceElements -> None}, 
 {{b, 5}, 0, 10, 1, Appearance -> {"Labeled"}, AppearanceElements -> None}, 
 Button["Calculate", parameters = {a, b}],

 (* === Other settings: === *)

 TrackedSymbols :> {parameters},
 Initialization -> (
   Clear[a, b, parameters, message, result];
   parameters = {5, 5}; result = 10; message = "Ready"
   )]

This is the result:

enter image description here

Vicent
  • 1.1k
  • 6
  • 16