Questions tagged [cedit]

Use this tag for questions related to the CEdit class (Windows edit control).

An edit control is a rectangular child window in which the user can enter text.

More in the MSDN documentation.

99 questions
13
votes
5 answers

How can I handle the Return key in a CEdit control?

How can I handle the Return key (VK_RETURN) in a CEdit control? The CEdit control is parented to a CDialog.
knaser
  • 1,421
  • 7
  • 19
  • 16
12
votes
3 answers

CEdit control maximum length? (in characters it can display)

What is the maximum length for the text string contained in a CEdit control in MFC? I get a beep when trying to add a character after the character 30001 is this documented anywhere? Can I display longer texts in a CEdit? Should I use another…
LLucasAlday
  • 2,349
  • 11
  • 34
  • 41
8
votes
3 answers

CEdit selects everything when getting focus

When I move to a CEdit control on my dialog using the tab key or the arrow keys all the text in the control is selected. This behaviour is causing me problems and I would prefer it if the control just put the cursor at the start (or end) of the text…
Hoppy
  • 720
  • 2
  • 12
  • 24
6
votes
2 answers

MFC: Changing the colour of CEdit

Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise.
Konrad
  • 39,751
  • 32
  • 78
  • 114
6
votes
2 answers

How to get text from CEdit control

I'm a new guy with ATL. So forgive me to ask this question. Problem description: One CEdit control is added into a ATL dialog class. It's attached in the dialog initialize function. //Define the edit control ATLControls::CEdit m_txtInput; //In the…
Erxin
  • 1,786
  • 4
  • 19
  • 33
5
votes
2 answers

Using derived Class from CEdit in my DIalog

I'm doing an application using MFC. I just made a class that is derived from CEdit so I could intercept OnChar() and do data validation. How do I substitute the edit control in my application with the derived one I made?
Artie
  • 493
  • 1
  • 7
  • 18
4
votes
3 answers

CEdit numeric validation event C++ MFC

I have a CEdit text box which is a part of a property pane and only allows numeric values (positive integers). The box works fine when people enter non-numeric values, but when they delete the value in the box a dialog pops up saying: "Please enter…
Kiril
  • 39,672
  • 31
  • 167
  • 226
4
votes
0 answers

MFC: How to add clear button inside CEdit?

I need to add a clear button inside the CEdit control like this: And I used CMFCEditBrowseCtrl, as described in this article: MFC Feature Pack - CMFCEditBrowseCtrl. But the problem is that it shows a very small icon on monitors with high pixel…
ViH
  • 419
  • 2
  • 14
3
votes
0 answers

Using Undo with CEdit and SetWindowText

In my derived CEditEx class I use: SetWindowText(strText); Works fine and the control is updated. But it does not support undo (CTRL + Z). If I manually type the change changes undo works. Is there no way to trigger it to track undo? Example…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
3
votes
0 answers

CEdit SetFont always creates a GDI HFONT handle, even for shared fonts

In our C++/MFC MDI application, each MDI client window contains a form based on CDialog that can contain very many controls, even hundreds of them. We have noticed that we run out of GDI handles relatively quickly (windows limit is 10000 per…
3
votes
1 answer

Why CSpinButtonCtrl is not handling correctly numbers higher than 1000?

I have a dialog in MFC with a CSpinButtonCtrl and an attached buddy (CEdit). They work correctly when the maximum value of the spin control is lower than 1000, but if it is higher, the value in the CEdit is clamped to the thousand units when the the…
cbuchart
  • 10,847
  • 9
  • 53
  • 93
3
votes
1 answer

in MFC when CEdit control reached the maximum characters, backspace doesn't work

in my dialog, there is a CEdit box, which set maximum character number. below in DoDataExchange function: void CDlgSurvey::DoDataExchange(CDataExchange* pDX) { DDX_Control(pDX, IDC_EDIT_SURVEY_ID, m_SurveyIDEdit);//ACUTALLY THE ISSUE IS HERE,SO…
Penny
  • 606
  • 1
  • 7
  • 15
3
votes
1 answer

Setting a CEdit control text value and it word-wrap

I have a CEdit control and I have it set as multiline in the resources. The user can type text and if it is too wide for the control it will word wrap. Great. Now, I know that I can pass in a string and include new line characters like \n to cause…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
2
votes
1 answer

MFC: Dynamic CEdit ctrl does not have the same visual style applied to it as a non dynamic CEdit ctrl

Recently I added the Common Controls 6.0 visual style to my MFC program which makes all the controls look more modern. When I dynamically create a CEdit button though it looks like the a old CEdit from Windows 95. All the other ctrls I dynamically…
2
votes
0 answers

User Subclassed class from CEdit value validation if DDX_Text is use

I have my own class (CMyEdit) subclassed from CEdit with own validation procedure. I hook events ON_CHAR and ON_UPDATE and validate user input. If the input is valid, attribute CMyEdit::isOk is switched to true. CMyEdit confirms validity during each…
Michal Hadraba
  • 347
  • 1
  • 11
1
2 3 4 5 6 7