Path: utzoo!attcan!uunet!dino!ux1.cso.uiuc.edu!uwm.edu!cs.utexas.edu!oakhill!tomj From: tomj@oakhill.UUCP (Tom Johnson) Newsgroups: comp.sys.mac.hypercard Subject: Re: selecting from a scrollable field Message-ID: <3083@oakhill.UUCP> Date: 14 Mar 90 15:57:57 GMT References: Reply-To: tomj@oakhill.UUCP (Tom Johnson) Organization: Motorola Inc., Austin, Texas Lines: 39 In article ako@cs.hut.fi (Arto Kojo) writes: > >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? Put the following script (or a reasonable facimile thereof) in a **LOCKED** scrollable field and it will return the contents of the selection line within the field. Note that this MUST run under HC 1.2 or later. on mouseUp put the mouseV into m put item 2 of the rect of me into t put the scroll of me into s put the textHeight of me into th put (round((m-t+s)/th + 0.5)) into l if l > (number of lines in me) then beep put "" into chosenNumber else put line l of me into chosenNumber end if end mouseUp You can also add double-click detection by inserting the following as the first two lines of the handler: wait 7 ticks if the mouseClick then put TRUE into dc else put FALSE into dc Then, later in the script: if dc=TRUE then endif Hope this helps. Tom Johnson tomj@oakhill.UUCP