[news.groups] Recursion Problem *HELP*

baum@Apple.COM (Allen J. Baum) (12/08/88)

[]
>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

stone@hydra.unm.edu.unm.edu (Andrew Stone CS.DEPT) (12/09/88)

In article <21877@apple.Apple.COM> baum@apple.UUCP (Allen Baum) writes:
>[]
>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
>--
>		  baum@apple.com		(408)974-3385

Allen, I like your solution, here is another version which also deselects
line:
  .....
  set locktext of me to false
  click at the clickloc
  select the selectedline
  put the selection into linevar
  set locktext of me to true
  wait 10   -- user interface: allows seeing the selection
  click at top of me + 1, right of me +1  --- deselects
  .....

||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||
||                                                                      ||
||	   Andrew Stone	    stone@hydra.unm.edu	    (505) 345-4800      ||
||                                                                      ||
||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||