Possible Duplicate:
Why do buttons with ChoiceDialog freeze the front end?
Why is SystemDialogInput failing to return a save file path?
Evaluation inside Button stops after some seconds
I am trying to use the code from:
Make a button that evaluates a function over and over
to make a button evaluate some code and plot the results, but when the code takes more than a few seconds it does not plot the results.
Here is a simple example that illustrates the problem I am having
For short time periods it works fine:
func := (Pause[1]; Plot[Sin[x], {x, 0, 5}]);
DynamicModule[{result = Null}, Column[{Button["Press", result = func], Dynamic[result]}]]
But if I change the pause to be 10 seconds it doesn't show the plot
func := (Pause[10]; Plot[Sin[x], {x, 0, 5}]);
DynamicModule[{result = Null}, Column[{Button["Press", result = func], Dynamic[result]}]]