Results 1 to 5 of 5

Thread: MFC Dialog Box Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    123

    Question MFC Dialog Box Question

    okay, I have a bit of static text which I placed on a dialog box. I mapped the ID of the text to a CString. I would like to change the actual text when I press a command button.

    i use:

    m_strHandText = "SOME TEXT ID LIKE TO DISPLAY";

    what do I now call to have that displayed at runtime in place of the current text displayed??

  2. #2

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    123
    okay i know i can use:

    SetDlgItemText(ID_HAND_TEXT,"THE TEXT I WANT");

    to accomplish this, but is there another way?

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Why do you need another way
    Try this
    Code:
    SetWindowText(handle, "text");
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think it's the UpdateData function...not totally sure
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    VirtuallyVB
    Guest
    When you said, "what do I now call to have that displayed at runtime in place of the current text displayed??", do you mean that you want to know how to have that text displayed when the app first runs and before the command button is pressed? That's unclear to me because you said, "now", after you described the command button technique.

    This works when the app initializes:
    In yourapp.cpp
    In BOOL CYourappApp::InitInstance()
    After CYourappDlg dlg;
    put dlg.m_strHandText = "SOME TEXT ID LIKE TO DISPLAY";

    If you meant, "how do I have the button update the text?", then in
    void CYourappDlg::OnA_Command_Button()
    put m_strHandText = "SOME TEXT ID LIKE TO DISPLAY";
    or SetDlgItemText(ID_HAND_TEXT,"THE TEXT I WANT");

    Please clarify.

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