Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!think!mintaka!bloom-beacon!eru!luth!sunic!tut!santra!cs.hut.fi!ako From: ako@cs.hut.fi (Arto Kojo) Newsgroups: comp.sys.mac.hypercard Subject: Re: selecting from a scrollable field Message-ID: Date: 14 Mar 90 09:16:14 GMT References: <16814@orstcs.CS.ORST.EDU> <16815@orstcs.CS.ORST.EDU> Sender: news@santra.uucp (Cnews - USENET news system) Organization: Helsinki University of Technology, Finland Lines: 50 In-Reply-To: abdenour@mist.cs.orst.edu's message of 13 Mar 90 08:52:22 GMT >From: abdenour@mist.cs.orst.edu (Abdennour A. MOUSSAOUI) >I have a list of numbers let us say from 1-1000. if I place them >in a scrollable field (one number per line), is it possible >write a script so that when a user click on a number then I will know >on which one he click on? I've included a (SuperCard) field script that does the thing you want and highlights the selected line with SC graphic item. Standard highlight ("select line lineN of card field 1") wasn't good enough for me. However, I've got a further problem: How to detect line wrapping in field (if any line wraps, the script gets mixed) or prevent lines from wrapping in SuperCard scrolling fields ???? ----clip clap---- on mouseUp put the mouseV into clickY put the short name of me && "hilite" into grcName set the cursor to 4 put 2 into marginal --normal sized margins if the wideMargins of me is true then add (the textSize of me div 3) to marginal subtract marginal from clickY put (clickY - the top of me + the scroll of me) div the textHeight of me + 1 into lineN if lineN < 1 then put 1 into lineN if lineN > the number of lines in me then put the number of lines in me into lineN put the top of me + marginal + (lineN - 1) * the textHeight of me - the scroll of me + (the height of card graphic grcName div 2) into newY put the left of me + 2 + (the width of card graphic grcName div 2) into newX set the loc of card graphic grcName to newX,newY show card graphic grcName end mouseUp -- :::: Arto Kojo :::::::::::::::::::::: Helsinki University of Technology :::: :: TKK/TKO-lab/Y227 ako@hutcs.hut.fi :: :: 02150 ESPOO FINLAND s29808u@puukko.hut.fi :: :::: tel: +358-0-4513236 :::::::::::: akojo@otax.tky.hut.fi ::::::::::::::::