Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool2.mu.edu!uwm.edu!psuvax1!psuvm!cunyvm!byuvm!byuvax!taylorj From: taylorj@yvax.byu.edu Newsgroups: comp.sys.mac.hypercard Subject: Re: Clicking on Fields Message-ID: <1884taylorj@yvax.byu.edu> Date: 15 Dec 90 02:14:51 GMT Lines: 35 Looks like it's again time to post my "definitive" clickRow function (formerly known as clickLine until HyperCard 2.0 stole the name). Unlike most functions floating around, this one handles scrolling and wide margins correctly. Of course, you can strip it down if you know you'll only use it with a certain kind of field. -- Returns the number of the line clicked on in the target field. -- Any wrapped line is counted as separate lines. -- Accounts for scrolling fields and wide margins. -- The fixedLineHeight property of the field must be true. function clickRow put the clickV - the top of the target into lineV if the style of the target = "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 clickRow An example of its use (in the script of a locked text field): on mouseUp select line clickRow() of me end mouseUp This handler has been largely obviated by the clickLine function of HyperCard 2.0, but it still comes in handy for fields with long lines that wrap, which HyperCard treats as single lines no matter how many "rows" the line takes up. Enjoy! Jim Taylor Microcomputer Support for Curriculum | Brigham Young University | Bitnet: taylorj@byuvax.bitnet 101 HRCB, Provo, UT 84602 | Internet: taylorj@yvax.byu.edu