home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!stanford.edu!eos!data.nas.nasa.gov!taligent!apple!dlyons
- From: dlyons@Apple.COM (David A Lyons)
- Newsgroups: comp.sys.apple2
- Subject: Re: Window Managing Help
- Message-ID: <71717@apple.Apple.COM>
- Date: 27 Aug 92 12:42:18 GMT
- References: <1992Aug21.025859.29356@news.iastate.edu> <mattd-240892162320@city-lights.apple.com>
- Organization: Apple Computer Inc., Cupertino, CA
- Lines: 61
-
- In article <1992Aug21.025859.29356@news.iastate.edu>, irsman@iastate.edu
- (Ian Schmidt) wrote:
- >[...] if the user clicks in the window (changing
- >the position of the selection cursor) while an update event is pending, Bad
- >Things happen (ie, I redraw the cursor, but if its old position isn't part of
- >the update region I end up with two cursors [not mouse cursors!] in the window,
- >which is obviously messy).
-
- Matt D writes:
- >Yes -- don't draw in your window outside of your window's update routine.
- >
- >If you move the cursor from one place to another, you should invalidate the
- >place where the cursor used to be, and invalidate the place where it should
- >be. When you get your next update event, your redraw routine should know
- >where the cursor's supposed to be now and draw things correctly.
-
- That will work, but in my opinion it's excessively complicated, and it will
- be sluggish.
-
-
- >If you want to draw in your window outside of your update routines, make
- >sure you don't wind up drawing something that your update routine will
- >draw differently, and make sure you set up the Window Manager environment
- >properly.
-
- *That* is the key...draw the same thing your update routine would have
- drawn, including the insertion point (cursor).
-
- My guess:
-
- * You are exclusive-or drawing your insertion point (fine).
-
- * When your update routine draws the window contents it assumes it's
- drawing on a fresh background, which it usually is.
-
- * When the insertion point moves, you xor-draw the insertion point at
- the old location (to remove it). If all or part of it wasn't actually
- there, you now have all or part of a bogus cursor.
-
- * When the window updates later, the window content gets overlaid on the
- bogus cursor.
-
- Solutions (pick one):
-
- * Have the update routine completely overwrite the area to be updated
- (by starting out with a huge EraseRect, or by drawing stuff to the
- entire area). -- Make sure to always draw the insertion point! If
- all or part of the insertion point is outside the area being updated,
- it will be clipped out automatically, no problem.
-
- * Handle any pending updates before moving the insertion point. (You
- can use EmptyRgn(GetUpdateRgn(yourWindow)) to see if you need an
- update; then call BeginUpdate, yourContentDraw, EndUpdate.
-
- I prefer the first way.
- --
- David A. Lyons, Apple Computer, Inc. | DAL Systems
- Apple II System Software Engineer | P.O. Box 875
- Internet:dlyons@apple.com | Cupertino, CA 95015-0875
-
- My opinions are my own, not Apple's.
-