Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
enhzflep11-Oct-11 21:43
enhzflep11-Oct-11 21:43 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Richard MacCutchan11-Oct-11 21:46
mveRichard MacCutchan11-Oct-11 21:46 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
enhzflep11-Oct-11 23:31
enhzflep11-Oct-11 23:31 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Madhu Nair11-Oct-11 21:44
Madhu Nair11-Oct-11 21:44 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon11-Oct-11 22:14
symeramon11-Oct-11 22:14 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Richard MacCutchan11-Oct-11 21:45
mveRichard MacCutchan11-Oct-11 21:45 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon11-Oct-11 22:21
symeramon11-Oct-11 22:21 
AnswerRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
David Crow12-Oct-11 3:10
David Crow12-Oct-11 3:10 
How about something like:

CMainDlg::OnButtonClick()
{
    CString strText;
    m_edit.GetWindowText(strText);
 
    CSecondDlg dlg;
    dlg.setData(strText);
 
    dlg.DoModal();
}
 
CSecondDlg::setData( LPCTSTR lpszText )
{
    m_strText = lpszText;
}
 
CSecondDlg:OnInitDialog()
{
    m_edit.SetWindowText(m_strText);
}
I'm a big fan of weak coupling, so tying these two dialogs together like this would not be my first choice. I would opt for a "data transfer" or "liaison" class instead. This is a one-instance class where you would put all of your shared data.

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous


GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon12-Oct-11 3:43
symeramon12-Oct-11 3:43 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
symeramon12-Oct-11 3:48
symeramon12-Oct-11 3:48 
GeneralRe: MFC - how to get an edit box text from another dialog?? (Constructor) Pin
Chandrasekharan P12-Oct-11 21:38
Chandrasekharan P12-Oct-11 21:38 
QuestionLANGID Pin
zon_cpp11-Oct-11 20:52
zon_cpp11-Oct-11 20:52 
AnswerRe: LANGID Pin
Richard MacCutchan11-Oct-11 21:42
mveRichard MacCutchan11-Oct-11 21:42 
AnswerRe: LANGID Pin
Richard MacCutchan11-Oct-11 23:18
mveRichard MacCutchan11-Oct-11 23:18 
AnswerRe: LANGID Pin
Randor 11-Oct-11 23:34
professional Randor 11-Oct-11 23:34 
QuestionCListCtrl Pin
john563211-Oct-11 20:43
john563211-Oct-11 20:43 
AnswerRe: CListCtrl Pin
zon_cpp11-Oct-11 21:03
zon_cpp11-Oct-11 21:03 
GeneralRe: CListCtrl Pin
john563211-Oct-11 22:00
john563211-Oct-11 22:00 
GeneralRe: CListCtrl Pin
Randor 11-Oct-11 23:10
professional Randor 11-Oct-11 23:10 
AnswerRe: CListCtrl Pin
Rolf Kristensen12-Oct-11 2:24
Rolf Kristensen12-Oct-11 2:24 
Questionhow to write/read in text file with mfc project?? Pin
antonio34311-Oct-11 7:29
antonio34311-Oct-11 7:29 
AnswerRe: how to write/read in text file with mfc project?? Pin
Richard MacCutchan11-Oct-11 7:49
mveRichard MacCutchan11-Oct-11 7:49 
GeneralRe: how to write/read in text file with mfc project?? Pin
antonio34311-Oct-11 7:53
antonio34311-Oct-11 7:53 
GeneralRe: how to write/read in text file with mfc project?? Pin
Richard MacCutchan11-Oct-11 8:08
mveRichard MacCutchan11-Oct-11 8:08 
GeneralRe: how to write/read in text file with mfc project?? Pin
antonio34311-Oct-11 8:30
antonio34311-Oct-11 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.