Monday 28 November 2011

What is the difference between the caret and the cursor? in C programming

What is the difference between the caret and the cursor?

In Windows, the cursor represents the mouse position on the screen. The caret represents the current editing position. If you look at the Windows program Notepad, for example, you’ll notice that as you move the mouse around, you see the familiar arrow move. This arrow is the cursor; it represents the current position
of the mouse.

If you type some text into the Notepad program, you’ll notice that the next available edit position in the Notepad window has a blinking vertical bar in it. This is the caret; it represents the current editing position. You can control the caret’s blink rate by invoking the Windows control panel. In Windows programs, five functions are available to control the caret. These functions are listed in Table

Functions to control the caret.
-----------------------------------------------------------------------------------------------------------------
Function Name                               Purpose
----------------------------------------------------------------------------------------------------------------
CreateCaret                                   Creates a caret
SetCaretPos                                   Sets the position of the caret
ShowCaret                                     Shows the caret
HideCaret                                       Hides the caret
DestroyCaret                                  Destroys the caret
------------------------------------------------------------------------------------------------------------------

If you’re a die-hard DOS programmer moving into Windows programming, you might think it odd that the “cursor” position actually represents the mouse position and not the editing position. This is just one little caveat you must get used to when joining the ranks of Windows programmers who now have to refer to the “cursor” position as the “caret” position.

Cross Reference:

None.

No comments:

Post a Comment