Click to See Complete Forum and Search --> : New at this; HELP!!!


joe joe
July 29th, 1999, 08:57 AM
What I want to do is have a user input numbers into a dialog box and then have those numbers put into a mathematical computation and then have the answer outputed to a window. With my program I access the dialog box from the view menu option on the title bar so I already have a window open. With this mathematical computation the answer can be 1 value or 1000 depending on the input. So what I want to do is output the answer to the main window I already have open or open a new window for the answer (I don't want the answer put into another dialog box). All data is transfered when the ok button is hit. Here is the code where I think?????? I should be doing this. Right now answer is outputed to a AfxMessageBox, but this is to small.



void CTestDlg::OnOK()
{
CString szEdit;
m_editTest.GetWindowText(szEdit);
AfxMessageBox(szEdit);
// TODO: Add extra validation here

CDialog::OnOK();
}
Thanks

Paul Belikian
July 29th, 1999, 11:12 PM
Hi,

If your variable in the dialog is public, your calling window can
access the variable.


void CSomeWnd::DoDialog()
{
CTestDlg Dlg;
if(Dlg.DoModal()==IDOK)
{
m_CStringViewVar = Dlg.m_szEdit;
}
}




As for printing it on your Main Window you can add some
code in your OnDraw function:


void CSomeWnd::OnDraw(CDC* pDC)
{
CSomeWndDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);


pDC->TextOut(0,0, m_CStringViewVar);
}




Drawing on Views isn't my strong point, but this should point
you in the right direction.



Regards,

Paul Belikian