Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Trouble refresh a UI window Dialog / MDI

Trouble refresh a UI window Dialog / MDI

Scheduled Pinned Locked Moved C / C++ / MFC
designhardwarequestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ScotDolan
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • S ScotDolan

      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

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      void Lenze8200_Dlg::OnTimer(UINT nIDEvent)
      {
      if (m_pDialog && ::IsWindow(m_pDialog->m_hWnd))
      m_pDialog->RedrawWindow();

      CFormView::OnTimer(nIDEvent);
      

      }

      S 1 Reply Last reply
      0
      • H Hans Dietrich

        void Lenze8200_Dlg::OnTimer(UINT nIDEvent)
        {
        if (m_pDialog && ::IsWindow(m_pDialog->m_hWnd))
        m_pDialog->RedrawWindow();

        CFormView::OnTimer(nIDEvent);
        

        }

        S Offline
        S Offline
        ScotDolan
        wrote on last edited by
        #3

        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

        H 1 Reply Last reply
        0
        • S ScotDolan

          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

          H Offline
          H Offline
          Hans Dietrich
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups