Hi daktaklakpak-2506
Maybe you could use OnEnChangeEdit
event to modify your string, and then use DoDataExchange
method to update your edit control, which is like:
void CMFCApplication1Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT1, m_editctrl);
if (str) {
DDX_Text(pDX, IDC_EDIT1, str);
}
}
void CMFCApplication1Dlg::OnEnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
GetDlgItemText(IDC_EDIT1,str);
if (str) {
CString r = str.Right(1);
if (r == 'I' || r == 'i')
str.Replace(r, _T("1"));
else if (r == 'E' || r == 'e')
str.Replace(r, _T("3"));
else if (r == 'O' || r == 'o')
str.Replace(r, _T("0"));
UpdateData(false);
len = m_editctrl.GetWindowTextLengthW();
m_editctrl.SetSel(len, len,false); //Move the cursor to the end of the text
m_editctrl.SetFocus();
}
}
Hope it could help you.
Best Regards,
Dylan
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our **documentation to enable e-mail notifications if you want to receive the related email notification for this thread.**