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

Login with username, password and session length
 
   Home   Help Search Login Register  
"Talk and eat less, think and listen more." ...Wisdom
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 7872 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  
"Talk and eat less, think and listen more." ...Wisdom
 
Jump to:  


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