NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
September 21, 2019, 03:45:28 am

"Nothing in life is to be feared, it is only to be understood." ..."Marie Curie 1867-1934, Polish born French Physicist, Twice Nobel Prize Winner- Physics and Chemistry)"

 Pages: [1]   Go Down
 Author Topic: Field control with minimum and maximum  (Read 8444 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Edward
Newbie

Offline

Posts: 4

 « Embed this message on: June 19, 2008, 02:07:36 am » posted from:Hengelo,Overijssel,Netherlands

I have a variable which I want to be controlled by 2 controls, a field and a slider control.
The slider control can be given a minimum and a maximum value. This is what I want.
To give the user the opportunity to give the variable an exact value, I have also introduced a field control. The problem is that the field control can't be given a minimum and a maximum value. I can use code to check the value, but I don't know how to undo the new value.

Anyone an idea to get this working?
 *** There are 1 more attached files. You need to login to acces it! Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #1 on: June 19, 2008, 03:48:36 pm »

if the variable is f, and the minimum and maximum you want is fmin, fmax
You can add the following to the action field for the numerical input textfield element

if(f<fmin)f=fmin;
else if(f>fmax)f=fmax;

Is that the logic you want. Just try to express your login into formula/equation.
 Logged
Edward
Newbie

Offline

Posts: 4

 « Embed this message Reply #2 on: June 20, 2008, 03:56:18 pm » posted from:Hengelo,Overijssel,Netherlands

Yes, this is what I wanted.
Thanks for this very simple solution.
 Logged
 Pages: [1]   Go Up
"Nothing in life is to be feared, it is only to be understood." ..."Marie Curie 1867-1934, Polish born French Physicist, Twice Nobel Prize Winner- Physics and Chemistry)"

 Related Topics Subject Started by Replies Views Last post Space ship control under gravitation field Kinematics Fu-Kwun Hwang 1 15482 April 15, 2016, 11:45:52 pm by lookang Can we increase traffic flow rate by increasing maximum speed limit? kinematics Fu-Kwun Hwang 6 23350 October 26, 2015, 04:02:10 pm by chengfu Minimum energy problem Dynamics Fu-Kwun Hwang 0 4810 February 22, 2010, 02:36:55 pm by Fu-Kwun Hwang Space ship control under gravitation field kinematics ahmedelshfie 0 3577 May 05, 2010, 06:38:08 pm by ahmedelshfie Minimum energy problem dynamics ahmedelshfie 0 3173 June 01, 2010, 01:18:38 am by ahmedelshfie
Page created in 0.05 seconds with 22 queries.since 2011/06/15