Changing a disabled edit ctrl's color.
-
I'm having trouble figuring out how to change the color of text in an edit control when it is disabled; such that the light grey (disabled) is black instead. Let's just say I have an edit control ('IDC_EDIT1'). CFont font; //in header font.CreatePointFont(280, "Arial Bold"); CWnd *pWnd = ((CWnd*)GetDlgItem(IDC_EDIT1); pWnd->EnableWindow(FALSE); //disables window //now I'd like to change the color of the text so it stays black. Any help would be greatly appreciated.
-
I'm having trouble figuring out how to change the color of text in an edit control when it is disabled; such that the light grey (disabled) is black instead. Let's just say I have an edit control ('IDC_EDIT1'). CFont font; //in header font.CreatePointFont(280, "Arial Bold"); CWnd *pWnd = ((CWnd*)GetDlgItem(IDC_EDIT1); pWnd->EnableWindow(FALSE); //disables window //now I'd like to change the color of the text so it stays black. Any help would be greatly appreciated.
What about making the edit control read-only instead of disabling it? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
What about making the edit control read-only instead of disabling it? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hrm, actually that a good idea; but, I don't know how to do that, either. I searched the web a little and found ES_READONLY. Further reading landed me EM_SETREADONLY. As I understand it, I need to call SendMessage to the window (editcontrol) I tried: pWnd->SendMessage(EM_SETREADONLY); and pWnd->SendMessage(ES_READONLY); But neither work - I am still able to edit the contents. What am I missing? thanks.
-
Hrm, actually that a good idea; but, I don't know how to do that, either. I searched the web a little and found ES_READONLY. Further reading landed me EM_SETREADONLY. As I understand it, I need to call SendMessage to the window (editcontrol) I tried: pWnd->SendMessage(EM_SETREADONLY); and pWnd->SendMessage(ES_READONLY); But neither work - I am still able to edit the contents. What am I missing? thanks.
Like2Byte wrote:
I tried: pWnd->SendMessage(EM_SETREADONLY);
Try: pWnd->SendMessage(EM_SETREADONLY, (WPARAM)TRUE); Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Like2Byte wrote:
I tried: pWnd->SendMessage(EM_SETREADONLY);
Try: pWnd->SendMessage(EM_SETREADONLY, (WPARAM)TRUE); Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Ah, geez. :doh: I'm going to go put my head in the sand. Gimme 10 minutes. Sincerely, thanks for the help!
Like2Byte wrote:
I'm going to go put my head in the sand.
Haha - that's the hard way to code! :)
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Like2Byte wrote:
I'm going to go put my head in the sand.
Haha - that's the hard way to code! :)
Mark Salsbery Microsoft MVP - Visual C++ :java: