[comp.windows.ms] cursor/caret question

kipnis@janus.Berkeley.EDU (Gary Kipnis) (12/01/89)

Hi, 

I am working on a program that constantly moves caret around the screen,
unfortunately when I use SetCaretPos() to advance caret to a new postion
most of the time the caret doesn't get erased from the previous position

any suggestions would be appreciated

Thank you,

gary

papa@pollux.usc.edu (Marco Papa) (12/01/89)

In article <32906@ucbvax.BERKELEY.EDU> kipnis@janus.Berkeley.EDU (Gary Kipnis) writes:
>I am working on a program that constantly moves caret around the screen,
>unfortunately when I use SetCaretPos() to advance caret to a new postion
>most of the time the caret doesn't get erased from the previous position. 
>any suggestions would be appreciated

Have you tried the following?

HideCaret()
.... do stuff ....
SetCaretPos()
ShowCaret()

-- Marco
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
"There's Alpha, Beta, Gamma, Diga and Caligari!" -- Rick Unland
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

mguyott@mirror.UUCP (Marc Guyott) (12/02/89)

In article <32906@ucbvax.BERKELEY.EDU> kipnis@janus.Berkeley.EDU (Gary Kipnis) writes:
>
>when I use SetCaretPos() to advance caret to a new postion
>most of the time the caret doesn't get erased from the previous position

You need to call HideCaret() before calling SetCaretPos() and you need to
call ShowCaret() after calling SetCaretPos().                    Marc
----
	      "All my life I always wanted to BE somebody.
	       I see now I should have been more specific."
			     Jane Wagner
Marc Guyott					    mguyott@mirror.tmc.com
{mit-eddie, pyramid, harvard!wjh12, xait}!mirror!mguyott
Mirror Systems		 Cambridge, MA	02140	       617/661-0777

bturner@hpcvlx.cv.hp.com (Bill Turner) (12/02/89)

/ hpcvlx:comp.windows.ms / kipnis@janus.Berkeley.EDU (Gary Kipnis) /  5:48 pm  Nov 30, 1989 /

Hi, 

I am working on a program that constantly moves caret around the screen,
unfortunately when I use SetCaretPos() to advance caret to a new postion
most of the time the caret doesn't get erased from the previous position

any suggestions would be appreciated

Thank you,

gary
----------

You need to call HideCaret before moving it, then call ShowCaret afterwards.
[I wasn't directly involved with it, but a word processing programming team
found that this was required to avoid the "caret turds," as they called them.]

--Bill Turner (bturner@hp-pcd.hp.com)
HP Corvallis Information Systems

garison@mirror.UUCP (Gary Piatt) (12/13/89)

Gary Kipnis writes:
=>I am working on a program that constantly moves caret around the screen,
=>unfortunately when I use SetCaretPos() to advance caret to a new postion
=>most of the time the caret doesn't get erased from the previous position

You have to hide it first, otherwise, Windows just moves the caret
without changing the previous display.  The easiest way to avoid
this is to create your own function, a la:

void
MySetCaretPos(x,y)
int		x,y;			/* New caret position */
{
    HideCaret(NULL);			/* Hide the caret */
    SetCaretPos(x,y);			/* Move it to new position */
    ShowCaret(NULL);			/* Display it again */
}

This should work.  You may need to replace the NULL with the
handle of the active window (or with GetActiveWindow()), in
which case you'll have to add another parameter.

				-Garison-