I have a list view control holding 4 columns of 512 items each. I need to change Items of the list view control frequently. Doing that causes flicker, because it erases the background each time. I send WM_SETREDRAW FALSE message to the control, change Items and send WM_SETREDRAW TRUE. What to do to make it flicker free?
Posted on 2004-04-08 09:59:13 by Vaxon
I have used the LVM_DELETEITEM message followed by the LVM_INSERTITEM for the 1st column item and the LVM_SETITEM for the other columns, using the same .iItem value in the struc and adjusting the .iSubItem for each column.

No need to redraw the entire window to change each item. I have not noticed flickering with the above.

Raymond
Posted on 2004-04-08 22:47:50 by Raymond
Thank you. i'll give it a try, but I don't delete any items at all. I use LVM_SETITEM for all items in all columns. It works fine, when I change just a couple of items, but when I need to change all of them at once, it causes flicker.
Posted on 2004-04-09 02:27:48 by Vaxon
Sounds like the window is being redrawn too often. Maybe try LockWindowUpdate before and after you add the items.

invoke LockWindowUpdate, [hListview]

; Add your items
invoke LockWindowUpdate, NULL

invoke UpdateWindow, [hListview]
Posted on 2004-04-09 02:46:17 by donkey
Thanks, I use WM_SETREDRAW message to disable update. It still will be redrawn after I unlock update, and redrawing will cause flicker. I subclassed list view control and disabled erasing background (WM_ERASEBKGND). No flicker, but there are some artefacts remainig sometimes after window size has been changed. I need to update the window at least 5 times per second.
Posted on 2004-04-09 03:09:43 by Vaxon
Does your LV parent has CS_HREDRAW+CS_VREDRAW styles?
Posted on 2004-04-09 07:28:27 by masquer
I don't know. The parent is a DialogBox.
Posted on 2004-04-09 09:02:54 by Vaxon

Sounds like the window is being redrawn too often. Maybe try LockWindowUpdate before and after you add the items.

The problem with LockWindowUpdate is that you can only lock one window in the whole system. There's a listview message that does the same without this problem, I don't remember it's name but you can search MSDN. :)
Posted on 2004-04-10 10:12:09 by QvasiModo
@Vaxon: You might want to try LVS_OWNERDATA. It's a lot of extra work, but it pays off in the end.

http://www.asmcommunity.net/board/index.php?topic=16902

Also you could try using callback strings. That way you can simply invalidate the RECT where your updated item is.
Posted on 2004-04-10 10:15:27 by QvasiModo
Thnk you, QvasiModo :) I never knew of these extended list view styles. Never saw any description of them in the MSDN. Are there any more styles for other common controls?
Posted on 2004-04-10 16:15:25 by Vaxon
Posted on 2004-04-12 14:38:55 by QvasiModo
Cool:alright: Thank you:)
Posted on 2004-04-13 02:25:04 by Vaxon