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. Update only a part of a View with OnUpdateAllViews 2nd !

Update only a part of a View with OnUpdateAllViews 2nd !

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++phpquestionannouncement
5 Posts 3 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.
  • C Offline
    C Offline
    CrocodileBuck
    wrote on last edited by
    #1

    Hi, i programmed a little app (SDI + RichCtrl). In this app. text is printed to the view when the program is started. When the user pushes the Button the ChangeText() fnct. in the doc will be called which only updates the rect with a new text. For a better understanding here is a pic: http://filehosting.at/images/download.php?file=585bdf52f01deea892f9e8b46fb652aa I tried with the UpdateAllViews() in the doc and OnUpdate() in the view.cpp. But it will not work ! To avoid posting too much code i coded a small sample which the same problem, perhaps you could have a look in the code ??? :-\ I really couldn't get it to work :(( :confused: http://www.filehosting.at/files/download.php?file=3e48616e695e66ed38f382a4c91fb3bc Many thanx for your help and best regards ;) Coc

    P 1 Reply Last reply
    0
    • C CrocodileBuck

      Hi, i programmed a little app (SDI + RichCtrl). In this app. text is printed to the view when the program is started. When the user pushes the Button the ChangeText() fnct. in the doc will be called which only updates the rect with a new text. For a better understanding here is a pic: http://filehosting.at/images/download.php?file=585bdf52f01deea892f9e8b46fb652aa I tried with the UpdateAllViews() in the doc and OnUpdate() in the view.cpp. But it will not work ! To avoid posting too much code i coded a small sample which the same problem, perhaps you could have a look in the code ??? :-\ I really couldn't get it to work :(( :confused: http://www.filehosting.at/files/download.php?file=3e48616e695e66ed38f382a4c91fb3bc Many thanx for your help and best regards ;) Coc

      P Offline
      P Offline
      Prasann Mayekar
      wrote on last edited by
      #2

      did u try Invalidate() ?

      C 1 Reply Last reply
      0
      • P Prasann Mayekar

        did u try Invalidate() ?

        C Offline
        C Offline
        CrocodileBuck
        wrote on last edited by
        #3

        Hi, i used InvalidateRect(); Please look in the small code ;) Many thanx Coc

        C 1 Reply Last reply
        0
        • C CrocodileBuck

          Hi, i used InvalidateRect(); Please look in the small code ;) Many thanx Coc

          C Offline
          C Offline
          CrocodileBuck
          wrote on last edited by
          #4

          This is the code from the doc:

          CString CON_UPDATE_DEMODoc::ChangeText()
          {
          CRect MyRect(0,0, 100, 100);
          CObject* pHint = (CObject*)&MyRect;

          m\_cstrAusgabe  = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
          m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
          m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
          m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
          m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
          
          
          UpdateAllViews(NULL, 1, pHint);
          return m\_cstrAusgabe;
          

          }

          and this from the view:

          void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
          {
          CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
          CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument()); //

          m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe);
          if (pHint != 0)
          {	
          	InvalidateRect((CRect\*)pHint, TRUE);
          
          	m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe);
          	return;
          
          }
          m\_Rich.SetModify(TRUE);	
          CView::OnUpdate(pSender, lHint, pHint);
          

          }

          D 1 Reply Last reply
          0
          • C CrocodileBuck

            This is the code from the doc:

            CString CON_UPDATE_DEMODoc::ChangeText()
            {
            CRect MyRect(0,0, 100, 100);
            CObject* pHint = (CObject*)&MyRect;

            m\_cstrAusgabe  = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
            m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
            m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
            m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
            m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
            
            
            UpdateAllViews(NULL, 1, pHint);
            return m\_cstrAusgabe;
            

            }

            and this from the view:

            void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
            {
            CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
            CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument()); //

            m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe);
            if (pHint != 0)
            {	
            	InvalidateRect((CRect\*)pHint, TRUE);
            
            	m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe);
            	return;
            
            }
            m\_Rich.SetModify(TRUE);	
            CView::OnUpdate(pSender, lHint, pHint);
            

            }

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            CrocodileBuck wrote:

            m_Rich.SetWindowText(pDoc->m_cstrAusgabe);

            Since m_Rich is a CRichEditCtrl, why not just derive your view from CRichEditView? Or, you can derive it from CFormView and add a CRichEditCtrl to it. Otherwise, the way you rare going about this is all wrong.

            "Love people and use things, not love things and use people." - Unknown

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            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