Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!psuvax1!psuvm!cunyvm!byuvax!taylorj From: taylorj@yvax.byu.edu Newsgroups: comp.sys.mac.hypercard Subject: Re: selecting from a scrollable field Message-ID: <1176taylorj@yvax.byu.edu> Date: 16 Mar 90 03:52:34 GMT Lines: 34 Yes, yes, I know lots of people posted their favorite script for selecting text from a field, but they all suffered from bloated code or wouldn't work in all cases. Below is the "canonical" clickLine function that handles regular fields, scrolling fields, and fields with wide margins: function clickLine put the clickV - the top of the target into lineV if the style of the target is "scrolling" then add the scroll of the target to lineV if the wideMargins of the target then subtract 4 from lineV return lineV div the textHeight of the target + 1 end clickLine You would use this in a locked field with a script something like on mouseUp select line clickLine() of me end mouseUp or on mouseUp go to card clickLine() -- where cards are numbered to correspond to lines in the field end mouseUp By the way, the "the"s in the script above make it run FASTER, not slower as you might expect. Jim Taylor Microcomputer Support for Curriculum | Brigham Young University | Bitnet: taylorj@byuvax.bitnet 101 HRCB, Provo, UT 84602 | Internet: taylorj@yvax.byu.edu