I am animating a graph and supplying a check box for the user to turn on or off the animation. In the script for the check box, I have a while loop that attempts to use the status of the check box to decide when to start and stop the animation. I have a couple of problems:
1. When I click the check box to enable the animation, the animation starts, but the check box does not have a chance to update its display. The only way I can get the check mark to show up is if I cover the graph window with another window so that Windows calls a redraw when I uncover it.
2. When I uncheck the checkbox, I get the message:
"DisplayBoxA second script is attempting to execute, possibly during a nested click event. It may be necessary to press Escape to terminate the previous script."
3. Probably closely related to 2. After checking and unchecking the box a couple of times, JMP crashes.
I think maybe part of the problem is that you need to refresh the entire window as opposed to just the chart. I've done that in the following copy of your script below, in which I've invented a dummy data set of my own to play with, and also created a new variable ("SliderFactor") to allow the arrows on the chart to update during the animation without the pointer on the slider bar jumping all over the place at the same time. This works for me in JMP7 as I imagine you'd expect it to work:
I've been experimenting again with the above to try to transform it into the simplest program I can concoct that still illustrates the problem, and have come up with the following, which in the form below appears to run (at least on my Windows XP laptop) in JMP7 but not JMP8:
Customer Support have just come up with the following workaround to the problem, which I've checked works for me in both JMP 7 and JMP 8:
There are a couple of ways to work around the JMP 8 behavior with nested clicks. One way to do it is use the schedule function to start the loop 0 seconds later, but there is no way to make it invisible. The second is as shown below, where the loop is outside of the Check Box and uses Wait() statements:
I just want to report how your scripts run on JMP for Mac. Your original rotating arrow script works as expected in JMP 7 but not in JMP 8. JMP 8 does not crash but the check box does not accept any more clicks after you checked it the first time. The only way is to force-stop the script, and everything is back to normal (no crash!).
However the solution in your latest post does not work in JMP 8 for Mac. It gets into a loop, and I I am not able uncheck the box. And the arrow is not even rotating!
Apparently there are some suboptimal code in JMP 8 and the symptoms are platform specific. Good that they seem to have this sorted out in JMP 9.
This works the way I wanted and it hasn't crashed for me in ver. 7.
I did notice that every time the check box is unchecked, the log reports:
"A second script is attempting to execute, possibly during a nested click event. It may be necessary to press Escape to terminate the previous script."
My first question is what part of the code is prompting this message? Secondly, is it possible that if the script is not exited properly, computer resources are not released properly and continued execution of the script will eventually cause a crash? For example, do I have a memory leak?
I have an interest in this myself, as I'm trying to assemble an interactive graphics display of my own at the moment, and mine is also crashing JMP if I try to stop the animation after it has been started. I'm therefore hoping that the answer to the above will supply the answer to my problem too. (Incidentally, I've also tried starting and stopping the animation with a pair of radio buttons with exactly the same result, so it's not just the check box.)
I've seen that message being sent to the log myself when the check box is clicked the second time, and although I don't know exactly which line of the script is causing it, I've no difficulty believing that it is trying to do two things at once - so I've just tried doing what it suggests, namely stopping the animation by pressing the key, and that seems to prevent the subsequent crash. I'm therefore now wondering whether a simulated press of the key could be incorporated (but trapped to prevent the resulting error message being sent to the screen, probably by using the Throw() and/or Try() functions) into the actions that are performed when the check box is unchecked. If I can work out how to do that I'll let you know.