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. Prevent Treeview from blinking when updating

Prevent Treeview from blinking when updating

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
10 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.
  • V Offline
    V Offline
    vivelesours
    wrote on last edited by
    #1

    I got some trouble with a mdi frame derived from Ctreeview, i need update my treeview data (insert or setitem several items very often ~100ms) and there is a blinking effect. When i use a CListView class to display my data i don't have such problem... Is it possible to do something to prevent my view from blinking my optimizing something? Thanks in advance. If someone needs more precisions please ask. Bye

    N 1 Reply Last reply
    0
    • V vivelesours

      I got some trouble with a mdi frame derived from Ctreeview, i need update my treeview data (insert or setitem several items very often ~100ms) and there is a blinking effect. When i use a CListView class to display my data i don't have such problem... Is it possible to do something to prevent my view from blinking my optimizing something? Thanks in advance. If someone needs more precisions please ask. Bye

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      You can use SetRedraw.


      Nibu thomas Software Developer Faqs by Michael dunn

      V 1 Reply Last reply
      0
      • N Nibu babu thomas

        You can use SetRedraw.


        Nibu thomas Software Developer Faqs by Michael dunn

        V Offline
        V Offline
        vivelesours
        wrote on last edited by
        #3

        It's is already done but it didn't do anything...

        A 1 Reply Last reply
        0
        • V vivelesours

          It's is already done but it didn't do anything...

          A Offline
          A Offline
          Andrew Hain
          wrote on last edited by
          #4

          You can also try making sure not to remove items and then add them back, or to add and then remove items.

          V 1 Reply Last reply
          0
          • A Andrew Hain

            You can also try making sure not to remove items and then add them back, or to add and then remove items.

            V Offline
            V Offline
            vivelesours
            wrote on last edited by
            #5

            Could you explain a little bit more. In my case i don't remove anything i just and or update items every 100ms... Here is my code (may be it can help) OnTimer() { GetTreeCtrl().SetRedraw(FALSE); while (something to add or update) { //Add Trace item in the ListCtrl/Treeview AddOrUpdate (SetItem or InsertItem) } //Allow to draw all modified lines in the ListCtrl GetTreeCtrl().SetRedraw(TRUE); }

            K A 2 Replies Last reply
            0
            • V vivelesours

              Could you explain a little bit more. In my case i don't remove anything i just and or update items every 100ms... Here is my code (may be it can help) OnTimer() { GetTreeCtrl().SetRedraw(FALSE); while (something to add or update) { //Add Trace item in the ListCtrl/Treeview AddOrUpdate (SetItem or InsertItem) } //Allow to draw all modified lines in the ListCtrl GetTreeCtrl().SetRedraw(TRUE); }

              K Offline
              K Offline
              kakan
              wrote on last edited by
              #6

              Maybe you should call SetRedraw(TRUE) only when there is a change in the tree. Something like this: OnTimer() { BOOL bChanged = FALSE; GetTreeCtrl().SetRedraw(FALSE); while (something to add or update) { bChanged = TRUE; //Add Trace item in the ListCtrl/Treeview AddOrUpdate (SetItem or InsertItem) } //Allow to draw all modified lines in the ListCtrl GetTreeCtrl().SetRedraw(bChanged); } -- modified at 7:49 Wednesday 10th May, 2006

              V 1 Reply Last reply
              0
              • V vivelesours

                Could you explain a little bit more. In my case i don't remove anything i just and or update items every 100ms... Here is my code (may be it can help) OnTimer() { GetTreeCtrl().SetRedraw(FALSE); while (something to add or update) { //Add Trace item in the ListCtrl/Treeview AddOrUpdate (SetItem or InsertItem) } //Allow to draw all modified lines in the ListCtrl GetTreeCtrl().SetRedraw(TRUE); }

                A Offline
                A Offline
                Andrew Hain
                wrote on last edited by
                #7

                At one time I was creating and deleting tree items in a tree and it flickered. Are you doing anything similar? Maybe you are changing node names or similarly visible attributes.

                V 1 Reply Last reply
                0
                • K kakan

                  Maybe you should call SetRedraw(TRUE) only when there is a change in the tree. Something like this: OnTimer() { BOOL bChanged = FALSE; GetTreeCtrl().SetRedraw(FALSE); while (something to add or update) { bChanged = TRUE; //Add Trace item in the ListCtrl/Treeview AddOrUpdate (SetItem or InsertItem) } //Allow to draw all modified lines in the ListCtrl GetTreeCtrl().SetRedraw(bChanged); } -- modified at 7:49 Wednesday 10th May, 2006

                  V Offline
                  V Offline
                  vivelesours
                  wrote on last edited by
                  #8

                  Unfortunatelly... I really think it comes from InsertItem/SetItem itself... it seems it erase the item and redraw item... and that for every items it's a christmas tree. ;-)

                  1 Reply Last reply
                  0
                  • A Andrew Hain

                    At one time I was creating and deleting tree items in a tree and it flickered. Are you doing anything similar? Maybe you are changing node names or similarly visible attributes.

                    V Offline
                    V Offline
                    vivelesours
                    wrote on last edited by
                    #9

                    Yes I change visible attribute but i do not erase anything. The blinking is quite special because even if my timer is 100ms the blinking period is not 100ms... it is almost 500ms... very strange, most of time treeview items remains and are not blinking even if item name changed! and others time it seems to erase item and redraw it => so blinking effect...

                    U 1 Reply Last reply
                    0
                    • V vivelesours

                      Yes I change visible attribute but i do not erase anything. The blinking is quite special because even if my timer is 100ms the blinking period is not 100ms... it is almost 500ms... very strange, most of time treeview items remains and are not blinking even if item name changed! and others time it seems to erase item and redraw it => so blinking effect...

                      U Offline
                      U Offline
                      User 3937278
                      wrote on last edited by
                      #10

                      myTreeView.BeginUpdate(); // do my refresh stuff myTreeView.EndUpdate();

                      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