What is wrong with this Script logic?

J. Landman Gay jacque at hyperactivesw.com
Fri Jan 11 14:20:46 EST 2013


On 1/11/13 8:16 AM, Ben Rubinstein wrote:
> On 11/01/2013 06:21, Mark Wieder wrote:
>> Jacque-
>>
>> Thursday, January 10, 2013, 9:39:35 PM, you wrote:
>>
>>> Something's wrong. I think it's the dialog.
>>
>> My guess is that closeField keeps getting triggered.
>
> It's definitely related to closeField, but there's some interaction with
> the dialog as well.

<snip test results>

>
> In other words the code is cycling through the loop, past the ask
> statement, but no dialog is appearing.

That's what I was seeing too. The modal dialog isn't blocking as it 
should, and the script keeps running. This seems to fix it:

on closefield
   send "hCheckEntry me" to me in 1
end closefield

on hCheckEntry pData
   repeat until pData is an integer
     if the shiftkey is down then exit to top
     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

So maybe it really was a sort of recursion, only it was in the 
closefield handler.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list