|
-
KoolMoves Moderator
how to test change in textbox
I'm trying to solve this little problem
I have a value in a text box and I want to process the number using the previous value with the new value, but I want to do it without the user having to push a button.
I tried setting the old value to a variable on onSetFocus then in the onChanged used it, this works so long as the user leaves the textfield before changing the value again. In other words if the user already changed the Value and then backspaces and changes it again I cannot get the value before change.
Code:
myshutter.onSetFocus=function(){
oshutter=Number(myshutter.text)
txt2.text=oshutter
}
myshutter.onChanged=function(){
oshutter=Number(myShuter.text)
txt1.text=shutter(myshutter.text,oshutter)
temp=shutter(200,180)
// var temp=shuttter(Number(myshutter.text),oshutter)
if (choice._currentframe==2){
//get new tstop
stop.text=Number(stop.text)*temp
}else{
//get new fps
}
}
-
Steve R
You could add a listener to it and watch for all the key presses, but it depends how many digits the number is as to how easy that would be to parse (you may get 1/2 a number)
It would be easy to read the number on a CR like that I think
Steve
-
KoolMoves Moderator
longest the number would be is 3 characters range is 11.2 to 180
-
Steve R
but if someone clears , say, 139 down to 1 and then starts adding characters ( a 2 then a 5) how do you know he is finished - for example is it 12 or 125?
Timeout?
I think listening for a carriage return and then reading the field may be your best substitute for a button.
Steve
-
KoolMoves Moderator
Steve you point out exactly some of the problems I've been dealing with. I'm thinking I might change that field to a combobox as the selections are limited to certain options.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|