1

I'm making a words remembering program with Mathematica. I almost finished it but I need to implement a dynamics to make it more beautiful.

Try the following code:

Clear["`*"]
mode = True;
p[text_] := 
Pane[Style[text, 80, Bold, FontFamily -> "Calibri"], 
ImageSize -> {500, 270}, Alignment -> Center, Appearance -> None, 
FrameMargins -> None],Dynamic[If[mode,
Button[Dynamic@
DynamicModule[{}, t = Clock[1, 10, 1]; 
 If[t == 1 || Not@mode, mode = False; p["CONTEXT"],
Graphics[{Opacity@.3, Darker@Green, Rectangle[{0, 0}, {t, 1}]}, 
   PlotRange -> {{0, 1}, {0, 1}}, ImageSize -> {500, 270}, 
   AspectRatio -> (27/50)]]], mode = False, 
Enabled -> Dynamic@mode, ImageSize -> {500, 270}], 
Button[p["Press Again"], mode = True]]]

As you can see, when you press the button or let the progression bar reach its end, it will show the word "Press Again". If you click it again, it will back to the progression bar, however, the progress will be saved and continued. I would like to reset it everytime when it goes back to the progression page but I failed after tens of trails changing the position of Dynamic and other things.

So, my question is how to solve this problem and reset the progression bar everytime it goes back to this page?

Thanks very much!


BTW: I think I will post a link to my program when I've finished~ :) I consider it as quite a good one

Wjx
  • 9,558
  • 1
  • 34
  • 70
  • Er, sorry @Kuba I cannot find much similarities between these two questions as this question is more about how to tune Dynamic so that the number will reset itself everytime and in this question, the indicator interface could be called out multiple times. However, your related question is more about run it once and able to cancel its running process and change the interface to another one. Is my interpretation correct? – Wjx Jun 16 '16 at 12:26
  • These contain solutions to similar problems: http://mathematica.stackexchange.com/a/96318/18476 & http://mathematica.stackexchange.com/a/102322/18476 – Karsten7 Jun 16 '16 at 16:17
  • Thank you all very much! I'll try them out~ – Wjx Jun 16 '16 at 23:52

0 Answers0