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 particial area of a View with UpdateAllViews(...)

Update only a particial area of a View with UpdateAllViews(...)

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestionannouncement
24 Posts 5 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.
  • M Mark Salsbery

    A simple call to InvalidateRect() in your OnUpdate() overrides should do it.

    void CMyView::OnUpdate(CView* pSender, LPARAM /*lHint*/, CObject* pHint)
    {
    InvalidateRect((CRect*)pHint, TRUE);
    }

    Mark

    Mark Salsbery Microsoft MVP - Visual C++ :java:

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

    Sry, i was too fast, but your version won't work Too ! Thax for all your help & best regards Croc

    1 Reply Last reply
    0
    • C CrocodileBuck

      Hi Mr. Salsbery, i tried

      InvalidateRect((LPCRECT)pHint, TRUE);
      

      but it won't work :( Thanx for all your help Croc

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #10

      What does "won't work" mean? If you're using a rect of (100,100,100,100) then nothing will happen, since the rect has no dimensions (width and height are 0). Try a valid rect! :) Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      C 1 Reply Last reply
      0
      • M Mark Salsbery

        What does "won't work" mean? If you're using a rect of (100,100,100,100) then nothing will happen, since the rect has no dimensions (width and height are 0). Try a valid rect! :) Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

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

        Hi, yes thats right but i tried it with

        CRect MyRect(0,0, 200, 150);
        CObject\* pHint = (CObject\*)&MyRect;
        

        and this fails too! Manx thanx and best regards Croc

        M 1 Reply Last reply
        0
        • C CrocodileBuck

          Hi, yes thats right but i tried it with

          CRect MyRect(0,0, 200, 150);
          CObject\* pHint = (CObject\*)&MyRect;
          

          and this fails too! Manx thanx and best regards Croc

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #12

          What does "fails" mean? Doesn't compile? Crashes at runtime? Nothing happens? It marks the area for updating. The next WM_PAINT message will update that area. If the same exact data is drawn as on the last WM_PAINT, you're not going to see a difference.

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          C 1 Reply Last reply
          0
          • M Mark Salsbery

            What does "fails" mean? Doesn't compile? Crashes at runtime? Nothing happens? It marks the area for updating. The next WM_PAINT message will update that area. If the same exact data is drawn as on the last WM_PAINT, you're not going to see a difference.

            Mark Salsbery Microsoft MVP - Visual C++ :java:

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

            I Mean nothin happens! Ahhh the InvalidateRect() hasn't to do something with the text printed in the RTFCtrl on the View ???!!! What can i do that i can see a little difference ????? Many many thanx for your help and best regards :) Croc

            M 1 Reply Last reply
            0
            • C CrocodileBuck

              I Mean nothin happens! Ahhh the InvalidateRect() hasn't to do something with the text printed in the RTFCtrl on the View ???!!! What can i do that i can see a little difference ????? Many many thanx for your help and best regards :) Croc

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #14

              CrocodileBuck wrote:

              What can i do that i can see a little difference ?

              You need to change something between calls to UpdateAllViews() if you want to see something different in the view. What are your views drawing? Something from the document? If so, change the document.

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              C 1 Reply Last reply
              0
              • M Mark Salsbery

                CrocodileBuck wrote:

                What can i do that i can see a little difference ?

                You need to change something between calls to UpdateAllViews() if you want to see something different in the view. What are your views drawing? Something from the document? If so, change the document.

                Mark Salsbery Microsoft MVP - Visual C++ :java:

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

                I will only print Text (SetWindowText) in the View !!!???? Many many thanks and best regards Croc

                M D 2 Replies Last reply
                0
                • C CrocodileBuck

                  I will only print Text (SetWindowText) in the View !!!???? Many many thanks and best regards Croc

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #16

                  Only you know what's going on in your views. The text data must be coming from somewhere... Change it and update the views! And make sure changing it doesn't already cause an update implicitly, or you still won't see anything. If the view is a window not in your control (where you don't do the painting, like an edit control), then you may not have control over updating regions of the window. If you are doing the painting in your view, look at the invalid rect in the WM_PAINT handler - you should see that your update rect is there. What you do with that info in your painting code is up to you. Mark

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  C L 2 Replies Last reply
                  0
                  • M Mark Salsbery

                    Only you know what's going on in your views. The text data must be coming from somewhere... Change it and update the views! And make sure changing it doesn't already cause an update implicitly, or you still won't see anything. If the view is a window not in your control (where you don't do the painting, like an edit control), then you may not have control over updating regions of the window. If you are doing the painting in your view, look at the invalid rect in the WM_PAINT handler - you should see that your update rect is there. What you do with that info in your painting code is up to you. Mark

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

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

                    Ok. Thanx, iwill try it ! Tomorrow i will mail my success or ... ;( ;) Many many thanx and best regards Croc

                    1 Reply Last reply
                    0
                    • C CrocodileBuck

                      I will only print Text (SetWindowText) in the View !!!???? Many many thanks and best regards Croc

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

                      What class is your view derived from?

                      "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

                      C 1 Reply Last reply
                      0
                      • M Mark Salsbery

                        Only you know what's going on in your views. The text data must be coming from somewhere... Change it and update the views! And make sure changing it doesn't already cause an update implicitly, or you still won't see anything. If the view is a window not in your control (where you don't do the painting, like an edit control), then you may not have control over updating regions of the window. If you are doing the painting in your view, look at the invalid rect in the WM_PAINT handler - you should see that your update rect is there. What you do with that info in your painting code is up to you. Mark

                        Mark Salsbery Microsoft MVP - Visual C++ :java:

                        L Offline
                        L Offline
                        led mike
                        wrote on last edited by
                        #19

                        You are in deep deep shit at this point dude. Maybe you should just treat the buck to a Filet-O-Fish and call it a day. :-D I'm outta here, have a great weekend! :beer:

                        led mike

                        M B 3 Replies Last reply
                        0
                        • L led mike

                          You are in deep deep shit at this point dude. Maybe you should just treat the buck to a Filet-O-Fish and call it a day. :-D I'm outta here, have a great weekend! :beer:

                          led mike

                          M Offline
                          M Offline
                          Mark Salsbery
                          wrote on last edited by
                          #20

                          Cheers! :beer:

                          Mark Salsbery Microsoft MVP - Visual C++ :java:

                          1 Reply Last reply
                          0
                          • D David Crow

                            What class is your view derived from?

                            "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

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

                            fom CView !

                            D 1 Reply Last reply
                            0
                            • C CrocodileBuck

                              fom CView !

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

                              CrocodileBuck wrote:

                              fom CView !

                              And you're using SetWindowText()? I've not ever tried that, but it just seems odd.

                              "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
                              • L led mike

                                You are in deep deep shit at this point dude. Maybe you should just treat the buck to a Filet-O-Fish and call it a day. :-D I'm outta here, have a great weekend! :beer:

                                led mike

                                B Offline
                                B Offline
                                Bram van Kampen
                                wrote on last edited by
                                #23

                                The Server stalled posting this one, (and crashed my Laptop) Tought it was Lost. Good for You, Enjoy

                                Bram van Kampen

                                modified on Saturday, July 12, 2008 9:02 PM

                                1 Reply Last reply
                                0
                                • L led mike

                                  You are in deep deep shit at this point dude. Maybe you should just treat the buck to a Filet-O-Fish and call it a day. :-D I'm outta here, have a great weekend! :beer:

                                  led mike

                                  B Offline
                                  B Offline
                                  Bram van Kampen
                                  wrote on last edited by
                                  #24

                                  led mike wrote:

                                  I'm outta here, have a great weekend!

                                  Just Enjoy, You Deserve. Wish I was there thoug, Regards :mad:

                                  Bram van Kampen

                                  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