Microsoft KB Archive/127153

{| = PRB: Caret Appears Outside Border in Multiline Edit Control =
 * width="100%"|

Article ID: Q127153

3.10 WINDOWS kbui kbprb The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) for Windows version 3.1

SYMPTOMS
If a multiline edit control is created with the WS_HSCROLL and ES_MULTILINE style, the caret may still be visible even when it is scrolled beyond the area of the edit control. For example, if a line is longer than the edit control and the caret is placed at the start of the line, when the the edit is scrolled toward the end of the line, the caret becomes visible outside of the control.

CAUSE
The CS_PARENTDC class style is on the standard edit control to allow Windows version 3.1 edit controls to be compatible with Windows version 3.0 edit controls. This causes this behavior.

RESOLUTION
To avoid this behavior:

 Give the parent window of the edit control the WS_CLIPCHILDREN style. -or- Use a superclass of the edit control with a class style of CS_DBLCLKS. This is different from the standard edit control, which has both the CS_DBLCLKS and CS_PARENTDC class styles set.

NOTE: Neither Windows NT version 3.5 nor Windows 95 exhibit this behavior. Additional reference words: 3.10 KBCategory: kbui kbprb KBSubcategory: UsrCtl Keywords : kb16bitonly
 * }