Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

DDX_Text with edit box

Can someone please advise me the proper way to get input from an edit box
in a dialog based application ?

On my form I have several edit boxes, and I know how to call UpdateData to
get input from ALL edit boxes together. What I hoped to do was call DDX_Text
from my code to get the input from a specific edit box, but I found no way
to supply the CDataExchange pointer that it requires, and I resorted to an
ugly get around by inserting conditional code into DoDataExchange.

It worked, but I would like to know how to do it properly.

All help appreciated

Bill Zemek
[621 byte] By [Bill Zemek] at [2007-11-10 12:51:06]
# 1 Re: DDX_Text with edit box
Hello,

use ClassWizard and create string variable for each edit box in your
dialog. Then you can set and get values like this:

CDialog dlg;
dlg.m_strEdit1 = _T("Text in edit box");
dlg.m_strEdit2 = myTextVariable;

if(dlg.DoModal() == IDOK)
{
myTextVariable = dlg.m_strEdit2;

AfxMessageBox(dlg.m_strEdit1);
}

For more see help for CWnd::UpdateData method.

HTH,

--
ChainsaW
Stanislav Simicek at 2007-11-11 20:42:04 >