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