Link to home
Start Free TrialLog in
Avatar of monster2
monster2

asked on

FlickerLess CListCtrl / DoubleBufferd

I Need WORKING example of FlickerLess CListCtrl.
I'm using win 2k and so far non of the exampes I found worked at all (they all flickerd when refreshing / updating items)

regards
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of monster2
monster2

ASKER

the problem is that I did'nt wonted to search trough items and to  change them.
I cleard whole list and then populate it from scratch.
I found some examples which should owerride oppaint and on erease handlers but they still flicker.
(I could use this examples to put background bitmap but that's not needed)
I wont to take dc from control make another for in memory drawing and then copy content the one in memory to real dc so that whole drawing is in memory.
use SetRedraw eg



    m_List.SetRedraw(FALSE); // turn drawing off regardless of list mode

//....
//Insert the items and or delete
//....

    m_List.SetRedraw(TRUE); // turn drawing back on and update the window
    m_List.Invalidate();
    m_List.UpdateWindow();

IT'S FLICKER


m_List.SetRedraw(TRUE);    m_List.Invalidate();
   m_List.UpdateWindow();

the problem is that the list itself is not doublebufferd
when I call UpdateWindow since it's not doublebufferd it flicker.
Only solution is doublebufering
then you will need to write you own - the above method will allow you to change the items and stop it trying to flicker but in the end you have to update the window to show the new contents
>>I cleard whole list and then populate it from scratch

That is the problem.  

Patient:  Doctor! Doctor! It hurts when I do this!
Doctor:  Well, stop doing that!

Instead of clearing the list and repopulating it, simply replace the old top item with the new top item, and work your way down the list.  After replacing all the items if there are still more, insert them at the end.

Turn off sorting.

-- Dan
will try that I'm to tired right now
Thanks
well it's not what I asked but since I have decided to use such method (and to change my code :) ) I will accept it

Regards
Thanks.
Better to use a simple, easy-to-understand, easy-to-maintain method than some convoluted double-buffer scheme anyway.

-- Dan