Modeless dialog communicating with parent dialog
-
Good day, I have a parent dialog instatialing a modeless dialog. My modeless dialog has a public function that updates the progress bar. Everytime I call tmpmodeless->UpdateProgressBar(step) where step is a number to increase, the progress bar show increase on display. I have also a public function in modeless dialog that updates the text for displaying the status tmpmodeless->UpdateMessageStatus(CString mymsg) but I doesnt update the display.. Here is my code: // Variables of modeless dialog CProgressCtrl m_ctrlProgress; // Created using MFC Class wizard so it sure points to the // control id of progress bar. CStatic m_statusdone; // Created using MFC Class wizard so it sure points to the // control id CStatic control id. Also sure that Visible property is checked. CMyParentDialog::MyInitialize() { CMyModelessDialog* tmpmodeless=new CMyModelessDialog(this); tmpmodeless->Create(CMyModelessDialog::IDD); tmpmodeless->ShowWindow(SW_SHOW); tmpmodeless->UpdateProgressBar(10); //OK is reflects on screen tmpmodeless->UpdateMessageStatus("Help me step 10"); doesnt change display.. tmpmodeless->UpdateProgressBar(20); //OK is reflects on screen tmpmodeless->UpdateMessageStatus("Help me step 20"); still doesnt change display.. } void CMyModelessDialog::UpdateProgressBar(int pStep) { m_ctrlProgress.SetPos(pStep); } void CMyModelessDialog::UpdateMessageStatus(CString mymsg) //Doesnt work.. why??????????????? { m_statusdone.SetWindowText(mymsg); UpdateData(TRUE); } Still Doesnt appear even if I manually put m_statusdone.SetWindowText("Test") under UpdateProgressBar because UpdateProgressBar sure does works on setting progressbar. Is there something Wrong with CStatic control???? Thanks.
-
Good day, I have a parent dialog instatialing a modeless dialog. My modeless dialog has a public function that updates the progress bar. Everytime I call tmpmodeless->UpdateProgressBar(step) where step is a number to increase, the progress bar show increase on display. I have also a public function in modeless dialog that updates the text for displaying the status tmpmodeless->UpdateMessageStatus(CString mymsg) but I doesnt update the display.. Here is my code: // Variables of modeless dialog CProgressCtrl m_ctrlProgress; // Created using MFC Class wizard so it sure points to the // control id of progress bar. CStatic m_statusdone; // Created using MFC Class wizard so it sure points to the // control id CStatic control id. Also sure that Visible property is checked. CMyParentDialog::MyInitialize() { CMyModelessDialog* tmpmodeless=new CMyModelessDialog(this); tmpmodeless->Create(CMyModelessDialog::IDD); tmpmodeless->ShowWindow(SW_SHOW); tmpmodeless->UpdateProgressBar(10); //OK is reflects on screen tmpmodeless->UpdateMessageStatus("Help me step 10"); doesnt change display.. tmpmodeless->UpdateProgressBar(20); //OK is reflects on screen tmpmodeless->UpdateMessageStatus("Help me step 20"); still doesnt change display.. } void CMyModelessDialog::UpdateProgressBar(int pStep) { m_ctrlProgress.SetPos(pStep); } void CMyModelessDialog::UpdateMessageStatus(CString mymsg) //Doesnt work.. why??????????????? { m_statusdone.SetWindowText(mymsg); UpdateData(TRUE); } Still Doesnt appear even if I manually put m_statusdone.SetWindowText("Test") under UpdateProgressBar because UpdateProgressBar sure does works on setting progressbar. Is there something Wrong with CStatic control???? Thanks.
fjlv2005 wrote: void CMyModelessDialog::UpdateMessageStatus(CString mymsg) //Doesnt work.. why??????????????? { m_statusdone.SetWindowText(mymsg); UpdateData(TRUE); } Why are you calling
UpdateData(TRUE)
at that point? Was it just for testing purposes? Make sure your static control uses an identifier different thanIDC_STATIC
(i.e, -1) -- jlr http://jlamas.blogspot.com/[^] -
fjlv2005 wrote: void CMyModelessDialog::UpdateMessageStatus(CString mymsg) //Doesnt work.. why??????????????? { m_statusdone.SetWindowText(mymsg); UpdateData(TRUE); } Why are you calling
UpdateData(TRUE)
at that point? Was it just for testing purposes? Make sure your static control uses an identifier different thanIDC_STATIC
(i.e, -1) -- jlr http://jlamas.blogspot.com/[^]