Didn't something change recently with the recursion limit? Maybe
something in the engine changed too. Also, I've had a few cases where
inserting a breakpoint changed the way the handler behaves, which makes
me think in this case the debugger is managing the recursion somehow.
I'm just guessing.
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
On 1/10/13 9:04 PM, Kay C Lan wrote:
What is wrong with this Script logic?
I've been staring at this too long and can't figure out what's wrong.
1) New Main Stack
2) Add 1 plain field
3) Set the flds Script to:
on closeField
hCheckEntry me
end closeField
on hCheckEntry pData
if (pData is not an integer) then
ask warning "Please enter only whole numbers!" with pData titled
"Enter A Number"
put it into tAnswer
if (tAnswer = empty ) then
exit to top
else
if (tAnswer is not an Integer) then
--breakpoint --Pos 1
hCheckEntry tAnswer
--breakpoint --Pos 2
else
put tAnswer into me
end if
end if
end if
end hCheckEntry
If I make the Pos 1 breakpoint active and Pos 2 inactive, then enter A
into the field the ask Dialog comes up with A. If I enter B into the
Dialog then the Dialog reappears with B; this continues for all the
bad data I enter. If I then enter a number or click "Cancel" it all
completes as it should. OK.
If I comment out Pos 1 breakpoint and make Pos 2 breakpoint active,
then when I enter A my ask Dialog comes up with A, BUT if I then enter
B I get an IDE window:
The handler: hCheckEntry has reached the recursion limit of: 400000
If I click the "OK" button on this window to make it go away I am then
presented with my ask Dialog with the B as the default.
If I press "Cancel" my ask Dialog Box comes back with "OK" as the
default answer.
If I press "Cancel" again it finally cancels.
At no time does the debug window come up at my breakpoint.
If I turn Debug Mode OFF, and repeat the above, after I enter B in my
ask Dialog I get the IDE Errors widow come up with:
Type: Handler: can't find handler
Object: fldTest
Line: hCheckEntry tAnswer
Hint: hCheckEntry
My Ask Dialog Box is also presented with B as the default. If I press
"Cancel" my ask Dialog comes back with "ask warning" as the default
answer. If I press 'Cancel' again, it finally cancels.
So why is my script having a recursion problem or not finding the handler?
I'm sure I've written many many similar data checking scripts over the
years and not had this happen.
LC 5.5.3 OS X 10.8.2
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
Jacqueline Landman Gay | [email protected]
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode