Page 1 of 1

Numeric value into text field returns un-desired response

Posted: Tue Oct 29, 2013 8:50 pm
by chris25
on closefield
  put me
if me is an integer then
      if me < 500 or me > 5000 then
        put empty into me
        answer "Please enter a value between 500 and 5000" with "OK then"
     end if
end if
end closefield


My problem here is that I have to use the exit mouseUp handler and I am not allowed to since livecode returns a fault. Normally I could say exit mouseUp so that th emessage box does not appear with the number that I entered. But I get this:
field "pixels": compilation error at line 10 (exit: bad destination expression) near "mouseUp", char 1

Re: Numeric value into text field returns un-desired respons

Posted: Tue Oct 29, 2013 9:38 pm
by Simon
Hi Chris,
Not following on this one.
What should it not do?

Simon

Re: Numeric value into text field returns un-desired respons

Posted: Tue Oct 29, 2013 11:25 pm
by Klaus
Hi Chris,

I am also a bit clueless, but if you want to exit a "closefield" handler, just do so:
...
exit closefield
...

Syntax is:
exit (name of the current handler*** that you are currently in and want to leave)
*** Be it mouseup, mousedown, closefield, closestack, opencard, scrollbardrag, your_handler_name_here ...everything :-)


Best

Klaus

Re: Numeric value into text field returns un-desired respons

Posted: Tue Oct 29, 2013 11:57 pm
by dunbarx
Hi.

Did you try to put a line like:

exit mouseUp

in the middle of the closeField handler? Thinking that this is a way to exit that handler? In that case Klaus nailed it. But without the full text of the handler, this is all guesswork. And Klaus alluded to what you should have written, but we will wait to see what you post back.

Craig

Re: Numeric value into text field returns un-desired respons

Posted: Wed Oct 30, 2013 12:07 am
by chris25
Hi, exiting the closefield handler was taking the user to the next step despite the code that declared that if the user typed in less than a certain integer an answer box appeared telling the user to type a number above a certain amount, after the answer box was declared the user was taken to the next step when he should not have been. This problem is now solved. Thankyou Klaus, and thankyou Simon. Thanks dunbarx. Simon kindly offered me this piece of code which solved the problem: focus on button "continue"

Re: Numeric value into text field returns un-desired respons

Posted: Wed Oct 30, 2013 4:24 am
by Simon
Hi Klaus, Craig,
Chris had written an "on closeField" handler that wasn't being triggered because the focus never left the field when clicking on a button. We just added a line to focus on something else.

After some more testing I realize now that it could have been fixed by selecting "Focus with keyboard" in the button inspector. :roll:

Simon

Re: Numeric value into text field returns un-desired respons

Posted: Wed Oct 30, 2013 12:02 pm
by Klaus
Hi Simon,
Simon wrote:Hi Klaus, Craig,
Chris had written an "on closeField" handler that wasn't being triggered because the focus never left the field when clicking on a button.
AHA! Go figure! :D


Best

Klaus