Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to distribute a .cdf to my students wherein they manipulate 5 locators on a graph to define various shapes. The .cdf opens with the locators in a "nice" position, but of course it is very hard to return the locators, by hand, to these positions once they have been moved. Is there a way to utilize a "Reset" button that returns all settings to the original state? The only method I can see right now is to reopen the file in the CDFPlayer.

share|improve this question

2 Answers 2

up vote 12 down vote accepted

Your average Manipulate has the "Inital settings" button (which is just another bookmark):

Mathematica graphics

Another straightforward way would be a simple button to set certain values:

Manipulate[x, {{x, 5}, 0, 10}, Button["Reset", x = 5]]

Mathematica graphics

which (as pointed out in the comments) allows for unlimited styling, for good or bad:

Manipulate[x, {{x, 5}, 0, 10}, 
 Button[Graphics[{EdgeForm[Directive[Thick, Black]], Red, Disk[], 
    Yellow, Style[Text["Don´t\n PANIC!", {0, 0}], Bold, 40]}], 
  x = 5, Background -> None]]

Mathematica graphics

share|improve this answer
    
I use the reset button method. More clear and you have more control on what to do there. Also for demo published at WRI web site, those options given in the menu above are not there. Only autorun is there. –  Nasser Aug 29 '13 at 13:07
    
I, too, like the Reset button better, as it is much more clear to the user. The built in ResetButton option also works, but isn't as clear as a big button that says "Reset." –  GregH Aug 29 '13 at 13:11
    
@Nasser o.k. - I only tried with the CDF preview, which shows all elements. And yes, the Button method is rather more transparent, even if the bookmarks are very useful in some cases. –  Yves Klett Aug 29 '13 at 13:12
    
@GregH and of course, you can Style your Button however you wish... –  Yves Klett Aug 29 '13 at 13:13
1  
@Mr.Wizard then this is one +1 I specially cherish :-) –  Yves Klett Aug 30 '13 at 7:22

Just another way, using built-in functionality ResetButton:

Manipulate[x, {{x, 5}, 0, 10}, AppearanceElements -> "ResetButton"]

enter image description here

share|improve this answer
    
I just learned something. +1 –  Mr.Wizard Aug 29 '13 at 19:35
1  
@Mr.Wizard So this day was a good day :) I'm glad you did. –  Kuba Aug 29 '13 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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