Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an CEdit (Edit control) on MFC dialog.

I have set the 'Read-Only' property of the control as TRUE. I am writing a process output to that control. When 'Reset' button is clicked, the text need to be cleared.

What I have tried:

I have used the below code to clear the text.

m_txtProcessOutput.SetWindowTextA("");

But this did not cleared the text.

I have tried setting the Read-Only property to FALSE. Then text is cleared. But the text box need to be Read-Only.

I have tried the below code also when 'Reset' button is clicked.

m_txtProcessOutput.SetReadOnly(0);
m_txtProcessOutput.SetWindowTextA("");
m_txtProcessOutput.SetReadOnly(1);


But this did not workout. Any suggestion is appreciated.
Posted
Updated 5-Apr-16 4:20am
Comments
Jochen Arndt 5-Apr-16 6:05am    
It should work.

You are using the control as process indicator. Check if other code portions will change the text back to something else. I would expect the Reset function to clear also some kind of progess variable.

BTW: Why you are using SetWindowTextA?

1 solution

Got the solution.

Used the below code.

CRect rect;
m_txtProcessOutput.SetWindowTextA("");
m_txtProcessOutput.GetWindowRect(&rect);
ScreenToClient(&rect);
InvalidateRect(&rect);
UpdateWindow();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900