home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!hamblin.math.byu.edu!news.byu.edu!ux1!fcom.cc.utah.edu!news
- From: Eric C. Kofoid <kofoid@bioscience.utah.edu>
- Subject: Re: Protecting a Text field
- Message-ID: <1992Nov23.211708.11525@fcom.cc.utah.edu>
- X-Xxdate: Mon, 23 Nov 92 21:08:46 GMT
- Sender: news@fcom.cc.utah.edu
- Organization: Dept. Biology, University of Utah
- X-Useragent: Nuntius v1.1.1d7
- References: <1992Nov20.000530.21486@tjhsst.vak12ed.edu>
- Date: Mon, 23 Nov 92 21:17:08 GMT
- Lines: 74
-
- In article <1992Nov20.000530.21486@tjhsst.vak12ed.edu> William Booz,
- bbooz@tjhsst.vak12ed.edu writes:
- >I have a stack with a main text field containing information
- >from card to card. I would like to keep the field locked so
- >it's contents aren't accidentally - or on purpose - changed,
- >but I also want browsers to be able to select blocks of text
- >they want within a given field, copy it and then paste the
- >selection into a collection "notepad" field I have on a Note
- >Pad card in the stack.
- >
- >I have created this handler and it works:
- >
- > on idle
- > if the optionKey is down then
- > set the lockText of bg fld id 9 to false
- > else
- > set the lockText of bg fld id 9 to true
- > end if
- > end idle
- >
- >I remember some discussion here some time ago that one should
- >avoid "on idle" handlers if possible. I have tried "on
- >mouseStillDown" and some other variations but they don't work.
- >
- >Question: what am I missing? Is there a more elegant solution
- >to my problem?
- >
- >Thanks in advance for any help.
- >--
- > _______________ __o Bill Booz, Fairfax, VA
- > _________________ -\<, bbooz@tjhsst.vak12ed.edu
- > ......O/ O Biking Is Fun!!
-
- Create your field, set the lockText to true and put the following
- handlers
- into the field script:
-
- on mouseDown
- set lockText of me to false
- click at the mouseLoc
- pass mouseDown
- end mouseDown
-
- on mouseStillDown
- global startDrag
- if startDrag = empty then put the mouseLoc into startDrag
- else drag from startDrag to the mouseLoc with shiftKey
- pass mouseStillDown
- end mouseStillDown
-
- on mouseUp
- finishDrag
- pass mouseUp
- end mouseUp
-
- on mouseLeave
- if the mouse = up then finishDrag
- pass mouseLeave
- end mouseLeave
-
- on finishDrag
- global startDrag
- set lockText of me to true
- put empty into startDrag
- end finishDrag
-
- Works like a champ.
-
- Cheers,
-
- ooo Dr. Cancer ooo
-
- "Being certain of the conclusion assists in finding the proof"
- Galileo, 17th century
-