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.

79 questions
12
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,371
  • 7
  • 18
  • 16
11
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…
rec
  • 2,011
  • 11
  • 31
  • 37
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
  • 668
  • 2
  • 9
  • 23
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
  • 35,953
  • 29
  • 74
  • 111
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,498
  • 3
  • 17
  • 32
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
  • 473
  • 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
  • 37,748
  • 29
  • 161
  • 218
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
  • 8,748
  • 6
  • 43
  • 72
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
  • 476
  • 1
  • 4
  • 13
2
votes
0 answers

MFC CEdit - Painting the Background at a Portion of Length

I would like to have a CEdit control, background-painted half-length or in any other portion of its length. I have implemented the following code HBRUSH CMyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr =…
DevMat
  • 23
  • 6
2
votes
2 answers

How can i modify the context menu of a CEdit control?

Before windows7 the solution was easy. Just add your own menu and write your own "Undo,Redo,Cut,Copy,Paste,Delete,Select All" menu items. But now this is not possible anymore because the menu has became really complex with the unicode and input…
Lothar
  • 11,018
  • 5
  • 66
  • 110
2
votes
2 answers

"Unlimited" CEdit text without ES_AutoHScroll

I'm having undesirable reflexes with ES_AUTOHSCROLL Set. What I'm trying to do is create an Edit that resizes with the text in it. However I hit a problem whenever the user types past the end of the edit. Without ES_AUTOHSCROLL the user cannot type…
Lee Louviere
  • 4,960
  • 28
  • 51
2
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
  • 13,595
  • 10
  • 45
  • 105
2
votes
2 answers

CEdit, WM_PASTE

let's say I've got a handler of the wm_paste message in a CEdit descendant: LRESULT CMyEdit::OnPaste(WPARAM wParam, LPARAM lParam) { //do some processing return 0; } and let's say that in some cases I want to trigger the default behaviour for…
Greg
  • 1,060
  • 5
  • 15
  • 41
2
votes
0 answers

changing font color of text in a disabled CEdit control

I want to change the font color of text in a disabled CEdit control which is currently system gray. As I use a gray background, I wish to change the font color of text ( currently set to rgb value of COLOR_GRAYTEXT) in order to make it easier to…
forcebrute
  • 21
  • 3
1
2 3 4 5 6