Trouble refresh a UI window Dialog / MDI
-
I have a MDI application which has a muliple dialog windows. One of these dialog windows needs to be update on regular basis. I am assume the best way to accomplish this is to add/create a OnTimer function and in it add code to refresh the window. What is the syntex for accomplish this.
void Lenze8200_Dlg::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) { // TODO: Add your specialized code here and/or call the base class Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_RED_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_GREEN_OFF_LED); Led_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); if( G2MainApp.pitch_is_connected() == false ) { m_iconPitchConnected.SetIcon( Red_ON ); }else{ m_iconPitchConnected.SetIcon( Green_ON ); } } void Lenze8200_Dlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CFormView::OnTimer(nIDEvent); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
-
I have a MDI application which has a muliple dialog windows. One of these dialog windows needs to be update on regular basis. I am assume the best way to accomplish this is to add/create a OnTimer function and in it add code to refresh the window. What is the syntex for accomplish this.
void Lenze8200_Dlg::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) { // TODO: Add your specialized code here and/or call the base class Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_RED_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_GREEN_OFF_LED); Led_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); if( G2MainApp.pitch_is_connected() == false ) { m_iconPitchConnected.SetIcon( Red_ON ); }else{ m_iconPitchConnected.SetIcon( Green_ON ); } } void Lenze8200_Dlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CFormView::OnTimer(nIDEvent); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
void Lenze8200_Dlg::OnTimer(UINT nIDEvent)
{
if (m_pDialog && ::IsWindow(m_pDialog->m_hWnd))
m_pDialog->RedrawWindow();CFormView::OnTimer(nIDEvent);
}
-
void Lenze8200_Dlg::OnTimer(UINT nIDEvent)
{
if (m_pDialog && ::IsWindow(m_pDialog->m_hWnd))
m_pDialog->RedrawWindow();CFormView::OnTimer(nIDEvent);
}
Hans, I get a compiler error when, i add this code. regarding &&. However, I might be because, i am not using the right object identify for m_pDialog. What should m_pDialog represent? How do find the name of the class i should use here Where is it define in the project. MFC create the following classes for me. MainFrm ChildFrm G2Motion G2MotionDoc G2MotionView
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
-
Hans, I get a compiler error when, i add this code. regarding &&. However, I might be because, i am not using the right object identify for m_pDialog. What should m_pDialog represent? How do find the name of the class i should use here Where is it define in the project. MFC create the following classes for me. MainFrm ChildFrm G2Motion G2MotionDoc G2MotionView
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
ScotDolan wrote:
What should m_pDialog represent?
Sorry, I was not clear.
m_pDialog
= pointer to dialog that you created. Of course, the dialog may also be a class variable, so you could just say:m\_MyDialog.RedrawWindow();
Best wishes, Hans