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

    component control for modeless dialog

    hi all..
    in my dialog based project I am using a modeless dialog and there is a label box in that dialog..From my main dialog, I am trying to pass a string to that label box after pushing the button ..But I can see nothing in the label box...Simply, my source code is:

    CMainDlg::OnButton1()
    {
    CModeless *p;
    p->m_display="sample"; //m_display=member variable for label box
    UpdateData(FALSE);

    but I see nothing in the label box which is located in the modeless box..

    I am looking forward to your suggestions...
    Thanks in advance---


  2. #2
    Join Date
    Oct 1999
    Location
    Germany
    Posts
    238

    Re: component control for modeless dialog

    Hi !

    a couple of comments concerning your code-fragment

    1. the pointer to your CModeless does not point anywhere.
    you are neither allocating memory for the object nor
    are you pointing it to an existing CModeless-object.

    2. If you want to update the dialogdata after changing the
    content of a membervariable associated with a control
    you need to call the UpdateData-Method of your
    CModeless, not of your CMainDlg

    Regards,

    Matthias.



  3. #3
    Guest

    Re: component control for modeless dialog


    then can u offer me a correct code fragment, using the names I declared in my previous question, friend?

    I would be very pleased of that...
    Regards....


  4. #4
    Join Date
    Oct 1999
    Location
    Germany
    Posts
    238

    Re: component control for modeless dialog

    Hi !

    here we go:
    // initialize p with a pointer to your CModeless
    // I don't know where you create it so I can't tell you how
    // to obtain the pointer at this point

    CModeless *p;

    // OK
    p->m_display="sample";

    // Changed
    p->UpdateData(FALSE);

    regards,

    Matthias.

    I had a thought,
    You know, I thought it a lot,
    I thought I was smart,
    Now I know that I'm not

    - The Presidents Of The United States Of America

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