clear100-com
asked on
Control Flickering (Listview)
Hello, How can I have a simple listview control that updates every 2 seconds not flicker?
Recently i posted this question: https://www.experts-exchange.com/questions/20774715/ListView-Flickering.html
OK, now im testing it and am noticing that it does an ok job, but still shows flickering and is anoying.
My test and example: Please download http://www.clear100.com/experts-exchange/listview_refresh/modListView_Colorize.zip
If you can download that there is also a little added bonus in it, it showes a sample of the flickering and i wanted to know if you can help me figure it out, and also it shows somthing else really cool with the list contorl, check it out and be supprised...
:D
Let me know as soon as you can please?
Bill.
Old Question: https://www.experts-exchange.com/questions/20774715/ListView-Flickering.html
Recently i posted this question: https://www.experts-exchange.com/questions/20774715/ListView-Flickering.html
OK, now im testing it and am noticing that it does an ok job, but still shows flickering and is anoying.
My test and example: Please download http://www.clear100.com/experts-exchange/listview_refresh/modListView_Colorize.zip
If you can download that there is also a little added bonus in it, it showes a sample of the flickering and i wanted to know if you can help me figure it out, and also it shows somthing else really cool with the list contorl, check it out and be supprised...
:D
Let me know as soon as you can please?
Bill.
Old Question: https://www.experts-exchange.com/questions/20774715/ListView-Flickering.html
ASKER
OK, thanks, but still going to keep this open for more input.
ASKER
The problem is, the app that im using this on i never know what the sze of the list is going to be, so in my case i just need to clear the list and refresh, i suppose i can re-write the code like you suggest wich may not be a bad thing at all, however i just want other ides if any exist (my doubts thogh that any more exist)
Bill.
Bill.
Can you not add and remove the additional entries as you get them?
If you are pulling them from a database is there a unique field (primary or foriegn key) that you can place in the key field of the listview which will allow you to check for new entries?
If you clear and rebuild the list every time it will be almost impossible to avoid the flickering, at least in my experience so far.
If you are pulling them from a database is there a unique field (primary or foriegn key) that you can place in the key field of the listview which will allow you to check for new entries?
If you clear and rebuild the list every time it will be almost impossible to avoid the flickering, at least in my experience so far.
ASKER
Not really, it will be hard to do this because as i get the info from the db i need to update the list acording to how the user has it sorted.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, im sorry i don't have more points, its really nice of you to help.
Not a problem, I participate here to increase my skills and knowledge not to get a high score :-D
ASKER
Ok, can you change the icons every other time (or on a random time) and see if it flickers? It is doing it for one of my apps.
Hmm, yep, noticable flicker when changing lots of icons, looks like it is rebuilding the entire line when the icon is changed.
Not been able to reduce it my end though. How often are you changing the icons?
Not been able to reduce it my end though. How often are you changing the icons?
ASKER
every second
Dim I As Integer
For I = 1 To 30
ListView1.ListItems.Add I, , , , 1
ListView1.ListItems(I).Sub
ListView1.ListItems(I).Sub
ListView1.ListItems(I).Sub
Next I
Timer1.Enabled = True
Timer1.Interval = Val(Trim(Text1.Text))
End Sub
Which is basically just initialising the listview, then in the timer have something similar to ...
Private Sub Timer1_Timer()
'LockWindowUpdate Me.hwnd
'ListView1.ListItems.Clear
Dim I As Integer
For I = 1 To 30
ListView1.ListItems(I).Sub
If ListView1.ListItems(I).Sub
If ListView1.ListItems(I).Sub
Next I
'LockWindowUpdate False
End Sub
In this example (least on my machine) the lockwindowupdate does little to remove the flickering, but if you are making large changes in bursts then I guess it would help more.
Basically avoid rewriting anything that doesn't need to be rewritten and you will avoid alot of flickering. I know this won't eliminate everything in your example, bt hopefully it will help.