Medic 84
Medic 84

Reputation: 1

Update an MFC EditControl

I have a login dialog for my MFC application in Visual Studio. By pressing an 'eye' button, the password attribute of the edit control gets enabled/disabled.

This works as expected; however, after pressing the button, the displayed text inside the edit control stays as it was until I move the cursor over the edit control.

Is there any way to 'tell' the edit control to update itself, so that I don't have to move the cursor over it?

This is my code, which is executed after pressing the 'eye' button:

if (((CEdit*)GetDlgItem(IDC_EDIT1))->GetPasswordChar() == 9679)
    ((CEdit*)GetDlgItem(IDC_EDIT1))->SetPasswordChar(0);
else
    ((CEdit*)GetDlgItem(IDC_EDIT1))->SetPasswordChar(9679);

I tried to send an EN_UPDATE message after setting the attribute of my edit control, but without any success.

Upvotes: 0

Views: 454

Answers (0)

Related Questions