Numeric value into text field returns un-desired response

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Numeric value into text field returns un-desired response

Post by chris25 » Tue Oct 29, 2013 8:50 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Tue Oct 29, 2013 9:38 pm

Hi Chris,
Not following on this one.
What should it not do?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Tue Oct 29, 2013 11:25 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Tue Oct 29, 2013 11:57 pm

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

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

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

Post by chris25 » Wed Oct 30, 2013 12:07 am

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"

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Wed Oct 30, 2013 4:24 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Wed Oct 30, 2013 12:02 pm

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

Post Reply