Xref: utzoo comp.sys.mac.hypercard:1334 news.groups:6453
Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!apple!baum
From: baum@Apple.COM (Allen J. Baum)
Newsgroups: comp.sys.mac.hypercard,news.groups
Subject: Re: Recursion Problem *HELP*
Message-ID: <21877@apple.Apple.COM>
Date: 8 Dec 88 00:09:10 GMT
References: <29191@tut.cis.ohio-state.edu>
Reply-To: baum@apple.UUCP (Allen Baum)
Organization: Apple Computer, Inc.
Lines: 29

[]
>In article <29191@tut.cis.ohio-state.edu> gibson@tut.cis.ohio-state.edu (William Kerr Gibson) writes:
>
>	I have a slight problem here that I hope somebody can help me with.
 ....describes too much recursion problem

The problem is that you have a locked text field. Clicks on a lock text field
send mouseup/down events to the field script. If the script itself clicks on
the field, then it will send the event to itself, causing infinite recursion.
There are several fixes. The easiest is to surround the click actions with
setting and clearing the locktext property. You may find this slow. You may
also just calculate the line number and select it: select line i of field x.
Then you don't have to click. Note that you may have problems with lines
which wrap.

Finally, the easiest thing to do (if you don't need the line number, but
just the line contents) is not calculate anything but just:

set locktext of field x to false
click at the clickloc
select the selectedline
put the selected into into linevar
set locktext of field x to true

This lets hypercard do all the calculation

--
		  baum@apple.com		(408)974-3385
{decwrl,hplabs}!amdahl!apple!baum