本文介绍了如何在MFC中禁用编辑控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi;
I have an edit control that takes string input from user and a CButton 'Record' to record that input. I want to catch the control and disable it when the user input is empty. I want to make sure that this enable/diable happens with the click of CButton.
void CCTRL::OnBnClicked() // code for Cbutton
{
CString txt;
if(!end)
{
IsCorrect(s); // comparing and checking user input
m_input.SetCheck(0);
if(Check())
Run();
}
}
IsCorrect() is where user input is checked and compared with correct text.
编辑控件是受时间驱动的,需要先禁用一段时间,然后用户才能再次单击它.
在显示控件之前,一旦某些文本输入到编辑控件中,cbutton可能会被禁用并变为启用状态.
等待建议.
预先感谢.
The edit control is time driven and need to be disabled for a certain time before user can again click it.
Could it be possible that before display of control, cbutton is disabled and becomes enable once some text is input into edit control.
Waiting for suggestions.
Thanks in advance.
推荐答案
m_someControlVariable.EnableWindow(TRUE);
或
or
m_someControlVariable.EnableWindow(FALSE);
<br />
if (str!="")<br />
{<br />
m_an.EnableWindow(TRUE)<br />
}<br />
else<br />
{
这篇关于如何在MFC中禁用编辑控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!