CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: modal dlg

  1. #1
    Join Date
    Feb 2003
    Location
    yuu
    Posts
    52

    modal dlg

    How can I make the edit box text of the main dlgbox = that of the modal dlg. That is, a project contains two dlg boxes, dlg1 and dlg2. One has an edit1 and the other edit2. How can I write code for a button in dlg1 so that the value of edit1 because whtever we have in edit2.
    I know how to create the project interface, but I just need that one line of code.

  2. #2
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    Hi,

    Look at
    Code:
    int GetWindowText(
      HWND hWnd,        // handle to window or control
      LPTSTR lpString,  // text buffer
      int nMaxCount     // maximum number of characters to copy
    );
    
    WM_GETTEXT
    
    WM_GETTEXTLENGTH
    Regards,

    Emanuel Vaduva

  3. #3
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    How really depends on exactly what you're trying to do. If you want to update dlg1 when dlg2 is dismissed (OnOK) then:

    Create a CString member variable for edit1 in dlg1, say szText1
    Create a CString member variable for edit2 in dlg2, say szText2

    if (dlg2.DoModal() == IDOK)
    {
    szText1 = dlg2.szText2;
    UpdateData();
    }

    If you want to update dlg1 as the text changes, i.e. reflect the keys that the user is typing, you'll need to pass a reference to dlg1 to dlg2 and update dlg1.edit1 in response to EN_CHANGE (I believe) notifications from edit 2
    bytz
    --This signature left intentionally blank--

  4. #4
    Join Date
    Feb 2003
    Location
    yuu
    Posts
    52
    szText1 = dlg2.szText2;
    does not work. They say 'operator =' function is unavailable

  5. #5
    Join Date
    Feb 2003
    Location
    yuu
    Posts
    52

    sorry

    i found the error, instead of CString i had CButton, by mistake.
    Thanks

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