-
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??
-
okay i know i can use:
SetDlgItemText(ID_HAND_TEXT,"THE TEXT I WANT");
to accomplish this, but is there another way?
-
Why do you need another way
Try this
Code:
SetWindowText(handle, "text");
-
I think it's the UpdateData function...not totally sure ;)
-
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.