UpdateData Problem
-
Hi, I have 2 edit box in my dialog, word and selecting a file .. first i have to enter the word then i have to select the file name in the file name i have used the below code, once i select the file, text which i have entered in the word edit box is getting erased, is there any way that after selecting file text in the word edit box does not get erased .. ----------------------------------------------------- void CSearchDlg::OnOpenIndex() { CString fname; CFileDialog m_ldFile(TRUE); if (m_ldFile.DoModal() == IDOK) { fname = m_ldFile.GetPathName(); m_INDEX_FILE=fname; UpdateData(FALSE); } } --------------------------------------------------- Using the above code we can open all types of files, i want to know how we can open only with file with specfic extenshion. Regards, Vinay Charan.
-
Hi, I have 2 edit box in my dialog, word and selecting a file .. first i have to enter the word then i have to select the file name in the file name i have used the below code, once i select the file, text which i have entered in the word edit box is getting erased, is there any way that after selecting file text in the word edit box does not get erased .. ----------------------------------------------------- void CSearchDlg::OnOpenIndex() { CString fname; CFileDialog m_ldFile(TRUE); if (m_ldFile.DoModal() == IDOK) { fname = m_ldFile.GetPathName(); m_INDEX_FILE=fname; UpdateData(FALSE); } } --------------------------------------------------- Using the above code we can open all types of files, i want to know how we can open only with file with specfic extenshion. Regards, Vinay Charan.
-
Hi, I have 2 edit box in my dialog, word and selecting a file .. first i have to enter the word then i have to select the file name in the file name i have used the below code, once i select the file, text which i have entered in the word edit box is getting erased, is there any way that after selecting file text in the word edit box does not get erased .. ----------------------------------------------------- void CSearchDlg::OnOpenIndex() { CString fname; CFileDialog m_ldFile(TRUE); if (m_ldFile.DoModal() == IDOK) { fname = m_ldFile.GetPathName(); m_INDEX_FILE=fname; UpdateData(FALSE); } } --------------------------------------------------- Using the above code we can open all types of files, i want to know how we can open only with file with specfic extenshion. Regards, Vinay Charan.
Vinay wrote:
UpdateData(FALSE);
Instead of FALSE use TRUE like
UpdateData(TRUE);
Knock out 't' from can't, You can if you think you can :cool:
-
Hi, I have 2 edit box in my dialog, word and selecting a file .. first i have to enter the word then i have to select the file name in the file name i have used the below code, once i select the file, text which i have entered in the word edit box is getting erased, is there any way that after selecting file text in the word edit box does not get erased .. ----------------------------------------------------- void CSearchDlg::OnOpenIndex() { CString fname; CFileDialog m_ldFile(TRUE); if (m_ldFile.DoModal() == IDOK) { fname = m_ldFile.GetPathName(); m_INDEX_FILE=fname; UpdateData(FALSE); } } --------------------------------------------------- Using the above code we can open all types of files, i want to know how we can open only with file with specfic extenshion. Regards, Vinay Charan.
-
Vinay wrote:
UpdateData(FALSE);
Instead of FALSE use TRUE like
UpdateData(TRUE);
Knock out 't' from can't, You can if you think you can :cool:
-
vinaycool wrote:
if i use the UpdateData(TRUE); the nthe value is not getting displayed....
Why don't you use
SetWindowText
andGetWindowText
for such simple manipulations. AsPJ
saidUpdateData
should be avoided for complex manipulations. Of course you can use it for one touch updations. Except for that it shouldn't be used. The nameUpdateData
itself is confusion. I personally get confused as to what's happening. :) I am not sure whether it's updating to the variable or to the control.
Nibu thomas Software Developer Programming Tips[^]
-
vinaycool wrote:
if i use the UpdateData(TRUE); the nthe value is not getting displayed....
Why don't you use
SetWindowText
andGetWindowText
for such simple manipulations. AsPJ
saidUpdateData
should be avoided for complex manipulations. Of course you can use it for one touch updations. Except for that it shouldn't be used. The nameUpdateData
itself is confusion. I personally get confused as to what's happening. :) I am not sure whether it's updating to the variable or to the control.
Nibu thomas Software Developer Programming Tips[^]
-
Hi Nibu thomas, I used m_ctrlINDEX_FILE.SetWindowText(fname); this is working fine... Thanks a lot .....:)
vinaycool wrote:
Hi Nibu thomas, I used m_ctrlINDEX_FILE.SetWindowText(fname); this is working fine... Thanks a lot
You're welcome. :)
Nibu thomas Software Developer Programming Tips[^] My site[^]
-
vinaycool wrote:
if i use the UpdateData(TRUE); the nthe value is not getting displayed....
Why don't you use
SetWindowText
andGetWindowText
for such simple manipulations. AsPJ
saidUpdateData
should be avoided for complex manipulations. Of course you can use it for one touch updations. Except for that it shouldn't be used. The nameUpdateData
itself is confusion. I personally get confused as to what's happening. :) I am not sure whether it's updating to the variable or to the control.
Nibu thomas Software Developer Programming Tips[^]
Nibu wrote:
The name UpdateData itself is confusion. I personally get confused as to what's happening. I am not sure whether it's updating to the variable or to the control.
Hey Nibu, don't get confused , let me clear the working of UpdateData()
UpdateData(TRUE)
Initialises all the control variables by retriving the contents from dialog controls
UpdateData(FALSE)
Initialises all the dialog controls by retriving the contents from Control variables. Hope you will understand how UpdateData works. :) Knock out 't' from can't, You can if you think you can :cool:
-
Nibu wrote:
The name UpdateData itself is confusion. I personally get confused as to what's happening. I am not sure whether it's updating to the variable or to the control.
Hey Nibu, don't get confused , let me clear the working of UpdateData()
UpdateData(TRUE)
Initialises all the control variables by retriving the contents from dialog controls
UpdateData(FALSE)
Initialises all the dialog controls by retriving the contents from Control variables. Hope you will understand how UpdateData works. :) Knock out 't' from can't, You can if you think you can :cool:
A_Laxman wrote:
Hey Nibu, don't get confused , let me clear the working of UpdateData()
:-D Hey I know how
UpdateData
works. But it's headache when you take a look at the code specially during maintenance (for me). So I tend to go forSetWindowText
andGetWindowText
.:) But it is not bad if it's sensibly used. I use it if I have to do one touch updation. For eg: when Save button is clicked, it works fine there for me. But I have seen people usingUpdateData
while writingAnimation
programs.:sigh: Bugs galore in such programs, because whenUpdateData
is called all variables bound to it are updated we cannot do selective updation.
Nibu thomas A Developer Programming tips[^] My site[^]