The caret


When textual data is being entered into an application, an underline or box shows the position of the next character. This item is referred to as a caret (not cursor). There are five functions used by applications to manipulate the caret. These are:

create_caret
show_caret
hide_caret
set_caret_position
destroy_caret

Carets should only be created when an application is gaining the focus. When an application is losing the focus, it should destroy the caret. By default, a caret is hidden when it is created. An application should make the caret visible after it has created the caret. If an application draws to a window in response to a message other than message::paint, it should hide the caret whilst performing the drawing. When the drawing is complete, the caret should then be made visible.

Examples

There are two examples on disk relating to character message processing. These are

Rather than discuss these two samples explicitly, it is left as an exercise for the reader to examine, compile, link and run the programs.