What is wrong with this Script logic?

Kay C Lan lan.kc.macmail at gmail.com
Thu Jan 10 23:52:28 EST 2013


On Fri, Jan 11, 2013 at 11:43 AM, J. Landman Gay
<jacque at hyperactivesw.com> wrote:
>
> Mostly what I wanted to say is that usually I avoid the whole issue like
> this:
>
> on hCheckEntry pData
>   repeat until pData is an integer
>
>     ask warning "Please enter only whole numbers!" with pData \
>        titled "Enter A Number"
>     if the result = "cancel" then exit to top
>     put it into pData
>   end repeat
>   put pData into me
> end hCheckEntry
>

Jacque,

Interesting, you solve my recursion problem by introducing a
potentially recursive repeat loop.

Craig,

I don't see how it is possible that 'the dialog line is skipped' and I
end up back in my hCheckEntry handler lower down - the ONLY way to
that lower handler is via the dialog, which, as in Jacques script,
offers the opportunity to prevent any recursion. As you say, move the
breakpoint to the closeField handler and the recursion goes away.
Remove the breakpoint completely and unfortunately it comes back.

Jacque,

I also don't understand how "OK" and "ask warning" (which is part of
the script itself) ends up as the ask dialog default, it's as if the
IDE is entering it's own data into the dialog and then answering it
itself.

Thanks though, your script works without issue so I can stop wasting
any more time worrying about why mine doesn't and just use your
solution and press on with more important issues.




More information about the use-livecode mailing list