home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20444 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.3 KB  |  48 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!saimiri.primate.wisc.edu!zazen!news
  3. From: koehn@vms.macc.wisc.edu
  4. Subject: Re: TCL: Did I Cheat, or What?
  5. Message-ID: <1992Dec30.223158.24766@macc.wisc.edu>
  6. Sender: news@macc.wisc.edu (USENET News System)
  7. Organization:  University of Wisconsin Academic Computing Center
  8. Date: 30 DEC 92 16:22:47    
  9. Lines: 37
  10.  
  11. In article <1992Dec30.171952.16320@fsl.noaa.gov>, urban@yoda.fsl.noaa.gov (Art Urban) writes...
  12.  
  13. >Last night I thought it would be great if I could write a CMouseTask
  14. >subclass which drags visual entities around in a window. Fine. I created a
  15. >subclass of CPane and in it invoked my CDragOutlineTask in a TrackMouse()
  16. >call. Much to my surprize this "nearly" worked. The problem I had was that
  17. >the click in CMyPane was invoking the Prepare() method which sets up a
  18. >clipRgn equal to CMyPane's aperture. Ergo, my DragGrayRgn() call was
  19. >getting clipped to CMyPane's bounding rectangle...not exactly what I was
  20. >hoping for.
  21. >So, I began to look for a method (inherited or otherwise) which would allow
  22. >me to redefine the clipRgn. I found none, so I passed a Prepare() message
  23. >to CMyPane's enclosure which conveniantly was theMainPane. This did the
  24. >trick. My gray region now is visible and clipped within the window. The
  25. >question is however, did I cheat? Was there a better way to achieve my
  26. >desired result?
  27. >Art Urban                             urban@yoda.fsl.noaa.gov
  28.  
  29. I recently wrote a similar routine, and came up with the same results, and even 
  30. the same quasi-guilty feelings of "Should I be doing this in some other way?", 
  31. but I couldn't find anything that was viable.
  32.  
  33. One possibility that occurs to me in retrospect, however, is that the code to 
  34. drage the CPane around could be handled by the enclosing pane. Ergo you would 
  35. have some code in your pane's DoClick routine that called 
  36. itsEnclosure->DragPane(this) or some other custom-written code. That code would 
  37. set up a MouseTask, and the DoTracking() method would call 
  38. itsPane->DrawGreyBorder() (again, your code, not TCL) to move it around.
  39.  
  40. This seems like a very ugly, round-about way of doing this, however, it has some 
  41. advantages. The enclosing Pane knows if it's a Panorama, for instance, and would 
  42. be able to call AutoScroll() when necessary.
  43.  
  44. Hope this helps,
  45. Brad Koehn
  46. koehn@macc.wisc.edu
  47.