CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Posts
    21

    New at this; HELP!!!

    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



  2. #2
    Join Date
    Jul 1999
    Location
    Pasadena, CA - USA
    Posts
    351

    Re: New at this; HELP!!!

    Hi,

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


    void CSomeWnd:oDialog()
    {
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured