Click to See Complete Forum and Search --> : how can I update the value in an edit box without using UpdataData(FALSE)
Danielle Harvey
May 17th, 1999, 01:16 PM
I have a dialog box which calls another dialog box. When the user changes values in the second dialog box, I want changes to be made to the first dialog box automatically. But when I use UpdateData(FALSE) in the OnOk() for the second dialog box, this only updates the values in the second dialog box and never the first.
How can I update the values in the first dialog box from the second dialog box OnOk() function without using UpdateData(FALSE)?
Any response any one can give me will be greatly appreciated.
Rail Jon Rogut
May 17th, 1999, 02:00 PM
There are different ways to handle this - the easiest (but not the better method) is to use SetWindowText() and enter the values directly into the edit controls - but this won't update the variables associated with the controls. The better method would be to create a public member function of the second dialog and have that call UpdateData(FALSE) -- call this public member function from the first dialog . You could also have a user defined message (WM_USER+xxxx) which calls this function, then in the first dialog you could send the user message to the second dialog.
Hope this helps.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/
i dont know if this is what you want...
add a member var. to your first (parent) dialog of your second (child) dialog, e.g.
CParentDlg : public CDialog
{
public:
CChildDlg m_dlgChild;
etc.
};
you can then treat its member variables as they were in the parent itself, e.g. DoModal on parent...
CParentDlg dlg;
dlg.m_var1 = <init a parent var.>
dlg.m_dlgChild.m_var1 = <init a child var.>
etc.
dlg.DoModal();
just treat m_dlgChild.m_varX as if they were actual member variables in the parent dialog.
Samantha
May 18th, 1999, 02:04 AM
You can use the function
SetDlgItemText( int nID, LPCTSTR lpszString );
nID : Identifies the control whose text is to be set.
lpszString : Points to a CString object or null-terminated string that contains the text to be copied to the control.
Hope this helps
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.