NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
May 21, 2018, 07:50:28 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  
Discovery consists of seeing what everybody has seen and thinking what nobody has thought. ..."Albert von Szent-Gyorgyi(1893-1986, 1937 Nobel Prize for Medicine, Lived to 93)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Field control with minimum and maximum  (Read 8105 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Edward
Newbie
*
Offline 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
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
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 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
  Print  
Discovery consists of seeing what everybody has seen and thinking what nobody has thought. ..."Albert von Szent-Gyorgyi(1893-1986, 1937 Nobel Prize for Medicine, Lived to 93)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Space ship control under gravitation field
Kinematics
Fu-Kwun Hwang 1 15029 Last post 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 22392 Last post October 26, 2015, 04:02:10 pm
by chengfu
Minimum energy problem
Dynamics
Fu-Kwun Hwang 0 4574 Last post February 22, 2010, 02:36:55 pm
by Fu-Kwun Hwang
Space ship control under gravitation field
kinematics
ahmedelshfie 0 3331 Last post May 05, 2010, 06:38:08 pm
by ahmedelshfie
Minimum energy problem
dynamics
ahmedelshfie 0 2949 Last post June 01, 2010, 01:18:38 am
by ahmedelshfie
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.051 seconds with 22 queries.since 2011/06/15