问题描述
我在MFC对话框上有一个CEdit(编辑控件)。
我已将控件的只读属性设置为TRUE。我正在为该控件编写流程输出。单击重置按钮时,需要清除文本。
我尝试过:
我用以下代码清除了文字。
m_txtProcessOutput.SetWindowTextA();
但这并没有清除文本。
我尝试将Read-Only属性设置为FALSE。然后文本被清除。但是文本框必须是只读的。
当点击重置按钮时,我也尝试了下面的代码。
m_txtProcessOutput.SetReadOnly(0);
m_txtProcessOutput.SetWindowTextA();
m_txtProcessOutput.SetReadOnly(1);
但这并没有锻炼。任何建议都表示赞赏。
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.
推荐答案
这篇关于当只读属性设置为TRUE时,无法清除cedit中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!