Prevent Treeview from blinking when updating
-
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
-
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
-
It's is already done but it didn't do anything...
-
It's is already done but it didn't do anything...
You can also try making sure not to remove items and then add them back, or to add and then remove items.
-
You can also try making sure not to remove items and then add them back, or to add and then remove items.
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); }
-
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); }
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 -
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); }
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.
-
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, 2006Unfortunatelly... 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. ;-)
-
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.
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...
-
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...
myTreeView.BeginUpdate(); // do my refresh stuff myTreeView.EndUpdate();