home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / hypercar / 4293 < prev    next >
Encoding:
Text File  |  1992-11-23  |  2.8 KB  |  88 lines

  1. Newsgroups: comp.sys.mac.hypercard
  2. 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
  3. From: Eric C. Kofoid <kofoid@bioscience.utah.edu>
  4. Subject: Re: Protecting a Text field
  5. Message-ID: <1992Nov23.211708.11525@fcom.cc.utah.edu>
  6. X-Xxdate: Mon, 23 Nov 92 21:08:46 GMT
  7. Sender: news@fcom.cc.utah.edu
  8. Organization: Dept. Biology, University of Utah
  9. X-Useragent: Nuntius v1.1.1d7
  10. References: <1992Nov20.000530.21486@tjhsst.vak12ed.edu>
  11. Date: Mon, 23 Nov 92 21:17:08 GMT
  12. Lines: 74
  13.  
  14. In article <1992Nov20.000530.21486@tjhsst.vak12ed.edu> William Booz,
  15. bbooz@tjhsst.vak12ed.edu writes:
  16. >I have a stack with a main text field containing information
  17. >from card to card.  I would like to keep the field locked so
  18. >it's contents aren't accidentally - or on purpose - changed,
  19. >but I also want browsers to be able to select blocks of text
  20. >they want within a given field, copy it and then paste the
  21. >selection into a collection "notepad" field I have on a Note
  22. >Pad card in the stack.
  23. >
  24. >I have created this handler and it works:
  25. >
  26. >    on idle
  27. >     if the optionKey is down then
  28. >      set the lockText of bg fld id 9 to false
  29. >     else
  30. >      set the lockText of bg fld id 9 to true
  31. >     end if
  32. >    end idle
  33. >
  34. >I remember some discussion here some time ago that one should
  35. >avoid "on idle" handlers if possible.  I have tried "on
  36. >mouseStillDown" and some other variations but they don't work.
  37. >
  38. >Question: what am I missing?  Is there a more elegant solution
  39. >to my problem?
  40. >
  41. >Thanks in advance for any help.
  42. >-- 
  43. >            _______________    __o        Bill Booz, Fairfax, VA
  44. >        _________________     -\<,       bbooz@tjhsst.vak12ed.edu
  45. >                        ......O/ O            Biking Is Fun!!
  46.  
  47. Create your field, set the lockText to true and put the following
  48. handlers 
  49. into the field script: 
  50.  
  51.           on mouseDown
  52.             set lockText of me to false
  53.             click at the mouseLoc
  54.             pass mouseDown
  55.           end mouseDown
  56.  
  57.           on mouseStillDown
  58.             global startDrag
  59.             if startDrag = empty then put the mouseLoc into startDrag
  60.             else drag from startDrag to the mouseLoc with shiftKey
  61.             pass mouseStillDown
  62.           end mouseStillDown
  63.  
  64.           on mouseUp
  65.             finishDrag
  66.             pass mouseUp
  67.           end mouseUp
  68.  
  69.           on mouseLeave
  70.             if the mouse = up then finishDrag
  71.             pass mouseLeave
  72.           end mouseLeave
  73.  
  74.           on finishDrag
  75.             global startDrag
  76.             set lockText of me to true
  77.             put empty into startDrag
  78.           end finishDrag
  79.  
  80. Works like a champ.
  81.  
  82. Cheers,
  83.  
  84. ooo Dr. Cancer ooo 
  85.  
  86.   "Being certain of the conclusion assists in finding the proof" 
  87.                                       Galileo, 17th century
  88.