John Kelley
April 10th, 1999, 09:11 PM
I struggled for while to find a way to change the diplayed data on a single dialog. I found a solution, but I think there must be a better way.
What I wanted to do was enter some data into an edit box, click a "Calculate" button right next to this box, and have the resulting data (after calculation) display in a read-only edit box at the bottom of the dialog. But I don't want the dialog to close.
The following is my temporary solution, assuming somebody can tell me a better way:
// Within DataDlg.cpp
...
void CDataDlg::OnCalculate()
CString Input; // Same type as m_Input_Data
CString Output; // Will be modification of Input
CDataDlg OutputDlg; // Declare a new data dialog
Input = m_Input_Data;
Output = m_Input_Data;
// Do other modifications to Output here
CDataDlg::OnOK(); // I had to get rid of the dialog so that I could...
// create an exact replica of previous dialog
// but with member variables initialized to Input & Output
OutputDlg.m_Input_Data = Input;
OutputDlg.m_Output_Data = Output;
OutputDlg.DoModal();
}
While this gives a pretty good illusion of modifying the same dialog, there is a flicker when the first dialog closes and the second one opens. Is there a way to have the m_Output_Data appear in the original dialog? I have tried UpdateData, Redraw, etc. but this dialog always stayed the same.
Thanks for any help!
"Try not. Do, or do not. There is no try." - Yoda
What I wanted to do was enter some data into an edit box, click a "Calculate" button right next to this box, and have the resulting data (after calculation) display in a read-only edit box at the bottom of the dialog. But I don't want the dialog to close.
The following is my temporary solution, assuming somebody can tell me a better way:
// Within DataDlg.cpp
...
void CDataDlg::OnCalculate()
CString Input; // Same type as m_Input_Data
CString Output; // Will be modification of Input
CDataDlg OutputDlg; // Declare a new data dialog
Input = m_Input_Data;
Output = m_Input_Data;
// Do other modifications to Output here
CDataDlg::OnOK(); // I had to get rid of the dialog so that I could...
// create an exact replica of previous dialog
// but with member variables initialized to Input & Output
OutputDlg.m_Input_Data = Input;
OutputDlg.m_Output_Data = Output;
OutputDlg.DoModal();
}
While this gives a pretty good illusion of modifying the same dialog, there is a flicker when the first dialog closes and the second one opens. Is there a way to have the m_Output_Data appear in the original dialog? I have tried UpdateData, Redraw, etc. but this dialog always stayed the same.
Thanks for any help!
"Try not. Do, or do not. There is no try." - Yoda