Alexander Shargin (rudankort@softspb.com), July 22, 2003.
I am using an edit box with no border. I noticed that it doesn't show caret when no text is entered to it. This also happens with comboboxes. Why does this happen? How can I fix this?
Each edit box internally stores left and right margin sizes. You can change these sizes by sending EM_SETMARGINS to the edit box. EM_GETMARGINS is used to determine current margin sizes. By default, margins are calculated based on the font assigned to edit box (this mode is enabled by EC_USEFONTINFO flag used with EM_SETMARGINS message). But this mode has some problems on Pocket PC. In fact it works for some fonts (e. g. System) but fails with others (e. g. Tahoma) so the problem probably has to do with fonts, not with OS itself.
First obvious solution is to change font of your edit box (or of the
entire dialog containing it). It can be done in resource editor
(
In MFC, CEdit::SetMargins method is used instead:
Drop-down comboboxes internally use borderless edit boxes to edit text. So obviously, they suffer from the same problem and the same solutions apply here. If you want to use second solution, you need to obtain HWND of edit box embedded inside combobox first. Since edit box is a child window of combobox, this is done using GetWindow function: