-
March 11th, 2003, 10:02 AM
#1
modal dlg
How can I make the edit box text of the main dlgbox = that of the modal dlg. That is, a project contains two dlg boxes, dlg1 and dlg2. One has an edit1 and the other edit2. How can I write code for a button in dlg1 so that the value of edit1 because whtever we have in edit2.
I know how to create the project interface, but I just need that one line of code.
-
March 11th, 2003, 11:04 AM
#2
Hi,
Look at
Code:
int GetWindowText(
HWND hWnd, // handle to window or control
LPTSTR lpString, // text buffer
int nMaxCount // maximum number of characters to copy
);
WM_GETTEXT
WM_GETTEXTLENGTH
Regards,
Emanuel Vaduva
-
March 11th, 2003, 11:11 AM
#3
How really depends on exactly what you're trying to do. If you want to update dlg1 when dlg2 is dismissed (OnOK) then:
Create a CString member variable for edit1 in dlg1, say szText1
Create a CString member variable for edit2 in dlg2, say szText2
if (dlg2.DoModal() == IDOK)
{
szText1 = dlg2.szText2;
UpdateData();
}
If you want to update dlg1 as the text changes, i.e. reflect the keys that the user is typing, you'll need to pass a reference to dlg1 to dlg2 and update dlg1.edit1 in response to EN_CHANGE (I believe) notifications from edit 2
bytz
--This signature left intentionally blank--
-
March 13th, 2003, 08:05 AM
#4
szText1 = dlg2.szText2;
does not work. They say 'operator =' function is unavailable
-
March 13th, 2003, 08:09 AM
#5
sorry
i found the error, instead of CString i had CButton, by mistake.
Thanks
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
|