Newsgroups: comp.sys.mac.hypercard
Path: utzoo!sq!lsuc!dave
From: dave@lsuc.on.ca (David Sherman|LSUC|Toronto)
Subject: Re: selecting from a scrollable field
Message-ID: <1990Mar15.052929.5942@lsuc.on.ca>
Organization: Law Society of Upper Canada, Toronto
References: <16814@orstcs.CS.ORST.EDU> <16815@orstcs.CS.ORST.EDU>
Date: Thu, 15 Mar 90 05:29:29 GMT

abdenour@mist.CS.ORST.EDU (Abdennour A. MOUSSAOUI) writes:
>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?

The below is what I use.  As well as being simple, it avoids the
problems of some of the other posted solutions when the line is
long enough to wrap around to a second line on the field.

Make sure the field is locked.

on mouseUp
  set the lockText of me to false -- to allow selecting
  click at the clickLoc
  click at the clickLoc
  -- now the word clicked on is selected
  set the lockText of me to true -- so the user can't muck around
  select the selectedLine -- optional, to highlight the whole line clicked on
  put word 2 of the selectedLine into lineNumber
  go card (line lineNumber of me) -- or whatever
end mouseUp

If what you have is a list of card numbers or card names, "go card"
will work fine.  Otherwise, just get line lineNumber of me and do
whatever you want with It (pun intended).

If you find this useful, please let me know.

David Sherman
Toronto
-- 
Moderator, mail.yiddish
{ uunet!attcan  att  utzoo }!lsuc!dave          dave@lsuc.on.ca
