Click to See Complete Forum and Search --> : Caret problem/edit control


Ernstegon
November 21st, 2007, 02:23 PM
I'm working on a touchscreen interface for an industrial PC. Sometimes text strings must be input without the use of a keyboard (pressing virtual keyboard buttons on the screen). The input goes into an edit control.

When a keyboard _is_ available, of course I want input from it to work as usual.

If I use the system font for the edit control, there is no problem. However, I need to use a larger font for better legibility. I therefore create a fixed-pitch font (Lucida Console, bold) and assign it to the edit control using a WM_SETFONT message. This works fine.

The problem is with the caret. When I input characters from an ordinary keyboard, the caret "drops" a static image of itself in the position that it vacates when a new character is input. See attached picture.

If I give the focus to another application and then return to my touchscreen application, then the "dropped" caret images disappear.

I do not use MFC, just straight Windows API.

If anyone has a clue as to why the caret is doing what it does, please let me know.

olivthill
November 24th, 2007, 03:25 PM
I have no idea, but since nobody is answering, I would suggest using a rich edit control instead of an edit control. Changing the font in a rich edit control is a task that is very reliable, as far I can tell from my experiences.