NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 11, 2017, 12:38:39 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"Progress, therfore, is not and accident,¡K" ..."Herbert Spencer(1820-1903, British philosopher)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: how to make a slider remember previous value after reset simulation.  (Read 6089 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: January 20, 2009, 09:33:14 am » posted from:Singapore,,Singapore

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!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: January 20, 2009, 01:26:25 pm » posted from:Taipei,T'ai-pei,Taiwan

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
Code:
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:
Code:
t=0;
x=xmin+size;
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: January 20, 2009, 01:37:25 pm » posted from:Singapore,,Singapore

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
Code:
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:
Code:
t=0;
x=xmin+size;

I think am already tinkering with stored values in the initialization page so should be ok now! thanks
Logged
Pages: [1]   Go Up
  Print  
"Progress, therfore, is not and accident,¡K" ..."Herbert Spencer(1820-1903, British philosopher)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
how to make the text b always appear after the simulation is reset?
Dynamics
lookang 16 15608 Last post July 26, 2007, 11:40:25 pm
by Fu-Kwun Hwang
how to make a slider time t that allows user to slide to replay simulation
Questions related to EJS
lookang 2 7980 Last post September 22, 2008, 02:36:43 pm
by lookang
how to make slider with fixed values for instance 1,2,5,10 50
Questions related to EJS
Fred Chuit 2 7227 Last post January 20, 2009, 09:23:48 am
by lookang
how do make Ejs applet run forever unless the pause or reset
Questions related to EJS
lookang 3 4951 Last post June 21, 2010, 07:52:30 pm
by Fu-Kwun Hwang
How to make gravitational simulation ?
Physlet builder (Create your own simulation)
GwenArBreizhou 22 55347 Last post May 06, 2015, 12:49:02 pm
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.069 seconds with 22 queries.since 2011/06/15