|
-
May 17th, 1999, 01:16 PM
#1
how can I update the value in an edit box without using UpdataData(FALSE)
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.
-
May 17th, 1999, 02:00 PM
#2
Re: how can I update the value in an edit box without using UpdataData(FALSE)
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
[email protected]
http://home.earthlink.net/~railro/
-
May 18th, 1999, 01:28 AM
#3
Re: how can I update the value in an edit box without using UpdataData(FALSE)
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.
-
May 18th, 1999, 02:04 AM
#4
Re: how can I update the value in an edit box without using UpdataData(FALSE)
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|