我正在尝试在 Visual Studio 2019 中设置 MFC C++ 应用程序,以便在用户键入时修改用户的文本。
当前布局是 2 个单选按钮,
ID= rdbOn(设置为 Group = True,Value int 变量m_isOn= 1)
ID= rdbOff,m_isOn值将是 =0

和 1 编辑控件 ID= txtInputBox,带有值CString变量m_inputString
目前,为了进行测试,我可以看到单击按钮时它是如何工作的,它需要类似于以下内容和SetDlgItemText结果。但那是在他们打字之后,而不是在他们打字的时候。
void Onsomebtnclick()
{
//convert CString to String of m_inputString
//do some string manipulation
//convert back to CString
//SetDlgItemText(txtInputBox, result)
}
更新:
开始EN_CHANGE工作
我能够EN_CHANGE处理来自用户@GoGoWorx 的标志建议。但是,现在我只是有一个小问题,光标回到了编辑控件的开头txtInput。
我正在阅读有关使用 aCEdit::SetSel但不知道如何在我的代码中直接使用它的信息。我尝试
了 CEdit 控件 MFC,在 SetWindowText 之后将光标放在字符串的末尾
someDlg::someFunction()
{
//some logic stuff to get a result string
SetDlgItemText(txtInputBox, result);
//need it to set the cursor to the end
//I tried these, but it didn't recognize (expression must have class type?)
//txtInputBox.SetSel(0, -1);
//txtInputBox.SetSel(-1);
}