Author Topic: how to make a slider remember previous value after reset simulation.  (Read 7328 times)

lookang

  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
how to make a slider remember previous value after reset simulation but yet also start off the first time only as a value say minimum of the slider?

I managed a way to get simulation to remember previous value after reset of simulation by leaving the initial value of the slider to be BLANK!

but i need to drag the slider for the value 1 to be registered into the slider variable mass1s which is  mass 1 stored, which i hope that a way to overcome the need to drag the slider for usability purposes.

is there is better solution to start with slider variable minimum but subsequently remember the stored values later?

i scan at some of your xml but i think i can't find an example that does this:)

thanks!

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: how to make a slider remember previous value after reset simulation.
« Reply #1 on: January 20, 2009, 02:26:25 pm »
Reset will reset  everything from the beginning (Nothing to be remembered!).
You should use _initialize() instead of _reset() 
to restart the simulation with different user setting.
(You need to and add code to initialize page to initial values)

For examples:
There is a slider to set vi, add _initialize() for drag action
Add the following code to initialize page
t=0;
x=xmin+size;
vx=vi; // vx will be set to user selected value
You can also have a slider to set vx.
Then, the code in the initialize page might be something like:
t=0;
x=xmin+size;

lookang

  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: how to make a slider remember previous value after reset simulation.
« Reply #2 on: January 20, 2009, 02:37:25 pm »
Reset will reset  everything from the beginning (Nothing to be remembered!).
You should use _initialize() instead of _reset() 
to restart the simulation with different user setting.
(You need to and add code to initialize page to initial values)

Oic..... i need to use _initialize() more often.


For examples:
There is a slider to set vi, add _initialize() for drag action
Add the following code to initialize page
t=0;
x=xmin+size;
vx=vi; // vx will be set to user selected value
You can also have a slider to set vx.
Then, the code in the initialize page might be something like:
t=0;
x=xmin+size;

I think am already tinkering with stored values in the initialization page so should be ok now! thanks