Text Updation
-
Hi, I have two CEdit controls in a dialog. In Change() event handler of first control, I'm using first control's value and setting another random value of second control and finally calling UpdateData(FALSE); But the text in first control remains same (old - whatever it was set in InitDialog()) and the caret is repositioned at first character. Why isn't text if first control changing and caret is being positioned at first character again and again? Can anyone help me out? Regards, Abhijeet
-
Hi, I have two CEdit controls in a dialog. In Change() event handler of first control, I'm using first control's value and setting another random value of second control and finally calling UpdateData(FALSE); But the text in first control remains same (old - whatever it was set in InitDialog()) and the caret is repositioned at first character. Why isn't text if first control changing and caret is being positioned at first character again and again? Can anyone help me out? Regards, Abhijeet
a_b_pathak wrote:
Why isn't text if first control changing
You stated "I'm using first control's value and setting another random value of second control". Why would that change the first control's text? Can you post the code for your "Change() event handler"? Mark
Mark Salsbery Microsoft MVP - Visual C++ This episode brought to you by the number 3
-
Hi, I have two CEdit controls in a dialog. In Change() event handler of first control, I'm using first control's value and setting another random value of second control and finally calling UpdateData(FALSE); But the text in first control remains same (old - whatever it was set in InitDialog()) and the caret is repositioned at first character. Why isn't text if first control changing and caret is being positioned at first character again and again? Can anyone help me out? Regards, Abhijeet
a_b_pathak wrote:
...and finally calling UpdateData(FALSE);
Why are you using
UpdateData()
for this? Just use aCEdit
member variable for each edit control, and call theSetWindowText()
method. For example:void CDlg::OnChangeEdit1( LPNMHDR, LRESULT* )
{
CString strEdit1;m\_edit1.GetWindowText(strEdit1); m\_edit2.SetWindowText("Hello " + strEdit1);
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi, I have two CEdit controls in a dialog. In Change() event handler of first control, I'm using first control's value and setting another random value of second control and finally calling UpdateData(FALSE); But the text in first control remains same (old - whatever it was set in InitDialog()) and the caret is repositioned at first character. Why isn't text if first control changing and caret is being positioned at first character again and again? Can anyone help me out? Regards, Abhijeet
I found it.... I forgot to call UpdateData(TRUE); at the start of function so the text of first control wasn't changing! stupid mistake though... I'm not using Set/GetWindowText because i'm using Control Variable (value).
-
I found it.... I forgot to call UpdateData(TRUE); at the start of function so the text of first control wasn't changing! stupid mistake though... I'm not using Set/GetWindowText because i'm using Control Variable (value).
a_b_pathak wrote:
I'm not using Set/GetWindowText because i'm using Control Variable
Then you can use the CWnd::GetWindowText/CWnd::SetWindowText methods, as DavidCrow stated. FYI - You don't always need to use UpdateData()...see Avoiding UpdateData[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ This episode brought to you by the number 3