Path: utzoo!utgpu!watmath!clyde!att!rutgers!tut.cis.ohio-state.edu!bloom-beacon!apple!baum From: baum@Apple.COM (Allen J. Baum) Newsgroups: comp.sys.mac.hypercard Subject: Re: returning line numbers from fields Message-ID: <21506@apple.Apple.COM> Date: 1 Dec 88 19:28:01 GMT References: <4296@umd5.umd.edu> Reply-To: baum@apple.UUCP (Allen Baum) Organization: Apple Computer, Inc. Lines: 52 [] >In article <4296@umd5.umd.edu> knox@umd5.umd.edu (Garry Knox) writes: > > Help. How can you get a line number returned when you click on a field? > Boy oh boy, would I like a good answer to this one. The ways that I've tried are: 1. start with locktext of the field set then, in the script of the field: on mouseup set the locktext of me to false --make sure click isn't intercepted click at the clickloc set the locktext of me to true return word 2 of the selectedLine end mouseup This is very slow- locking and unlocking the field seems to be the culprit, but I'm not sure. This script gives virtual line numbers, i.e. wrapped lines count as a single line. 1A. Like the above, but cover the field with a button. Locktext of the field should be false. Instead of locking/unlocking the field, hide/show the button. Also slow- hiding/showing the button may be the culprit 2. start with locktext of the field set, or with a button covering the field. Then, in the script of the field or button: on mouseup return (the clicky - the top of me + the scroll of me)/the textheight of me end mouseup Much faster, but wrapped lines are counted as two lines What I'd really like to do is have a scrolling field I can treat just like the fields in the font/da mover, i.e. clicking on a line in the field highlights the line, draging highlights more, and shift-click extends the selection. Both line number, and number of lines should be returned, I can do this with script 1. above, " selecting the selectedtext" and returning "the number of lines of the selectedtext", but its horribly slow for such a simple function (several seconds). Anyone have any better ideas? -- baum@apple.com (408)974-3385 {decwrl,hplabs}!amdahl!apple!baum