It is illustrated by clicking 10 and then immediately clicking 1, that is, you shouldn't have to wait, it should stop pausing for ten seconds and begin pausing for only one second.

In general, Mathematica does not release a previous computation until the current one is finished. I need to override this in my application, which involves a computationally expensive function for only some values in the slider, and I want the computation to stop and restart when the mouse is dragged.

A Manipulate itself is not necessary for me, perhaps some trickery with Dynamics can achieve this? Also, would your solution work if the function that the slider drives is written with javalink?

1 Answer
1

Ok, I still hope for a solution to the more general question on how to abort and relaunch a main link evaluation from the preemtpive link. But I'll offer a simple solution to the problem at hand. It just demonstrates how you can use a flag to stop your computation.

When I drag the slider all the way to the right and let go and then immediately drag it all the way back to the left I shouldn't have to wait the whole 19 seconds. But I don't see how your code fixes this....

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.