ListView control flickers when adding new items 
Author Message
 ListView control flickers when adding new items

I am developing an application which involves putting a large number of
listitems into a listview control. (A couple of thousand or so).

Each time a new listitem is added, the entire listview repaints. This
wouldn't be so bad if it only occured whilst filling those items which the
user can see but even if the listitem being added is off the bottom of the
listview, it still repaints itself causing an headache inducing flicker.

Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
but I think this may be a job for the WIN32 API.

Thanks in advance,
Chris.



Sun, 21 Jan 2001 03:00:00 GMT  
 ListView control flickers when adding new items
You might try setting the redraw capability of the ListView to false while
you add the items.  For example:

Public Sub SetRedraw(hwnd As Long, bRedraw As Boolean)

   Dim lReturnValue As Long

   lReturnValue = SendMessage(hwnd, WM_SETREDRAW, bRedraw, 0)

End Sub
Sub Main()

   Call SetRedraw(ListView1.hwnd, False)

   'Add items

   Call SetRedraw(ListView1.hwnd, False)

End Sub

I also remember that there was another setting that you should fiddle with
(as per someone else's post a while back), but I can't recall the specifics.
But this should get you going for now!

Quote:

>I am developing an application which involves putting a large number of
>listitems into a listview control. (A couple of thousand or so).

>Each time a new listitem is added, the entire listview repaints. This
>wouldn't be so bad if it only occured whilst filling those items which the
>user can see but even if the listitem being added is off the bottom of the
>listview, it still repaints itself causing an headache inducing flicker.

>Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
>but I think this may be a job for the WIN32 API.

>Thanks in advance,
>Chris.



Sun, 21 Jan 2001 03:00:00 GMT  
 ListView control flickers when adding new items
Try this,

Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate"
(ByVal hwndLock As Long) As Long

Private Sub FillList()
    LockWindowUpdate Me.hWnd
    'Fill the list
    LockWindowUpdate 0
End Sub

DD

Quote:

>I am developing an application which involves putting a large number of
>listitems into a listview control. (A couple of thousand or so).

>Each time a new listitem is added, the entire listview repaints. This
>wouldn't be so bad if it only occured whilst filling those items which the
>user can see but even if the listitem being added is off the bottom of the
>listview, it still repaints itself causing an headache inducing flicker.

>Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
>but I think this may be a job for the WIN32 API.

>Thanks in advance,
>Chris.



Sun, 21 Jan 2001 03:00:00 GMT  
 ListView control flickers when adding new items
Look at WM_REDRAW.  This tells the control whether to update continually or
not.  If you turn it off during updates, and then on when you are done.
Quote:

>I am developing an application which involves putting a large number of
>listitems into a listview control. (A couple of thousand or so).

>Each time a new listitem is added, the entire listview repaints. This
>wouldn't be so bad if it only occured whilst filling those items which the
>user can see but even if the listitem being added is off the bottom of the
>listview, it still repaints itself causing an headache inducing flicker.

>Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
>but I think this may be a job for the WIN32 API.

>Thanks in advance,
>Chris.



Mon, 22 Jan 2001 03:00:00 GMT  
 ListView control flickers when adding new items
You can switch off the screenupdating using the sendmessage API..!!

#If Win32 Then

Public Declare Function SendMessage Lib "user32" Alias _
       "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
       ByVal wParam As Long, lParam As Long) As Long

#Else

Public Declare Function SendMessage Lib "User" ( _
       ByVal hwnd As Integer, ByVal wMsg As Integer, _
       ByVal wParam As Integer, lParam As Any) As Long
#End If

Public Const WM_SETREDRAW = &HB
Public Const REDRAWOFF = 0
Public Const REDRAWON = 1

Call SendMessage(Me.hwnd, WM_SETREDRAW, REDRAWOFF, 0) ' Turn Paint Off

....do some item adding..!!

Call SendMessage(Me.hwnd, WM_SETREDRAW, REDRAWON, 0) ' Turn Paint back on

<Control>.Refresh

Quote:

>I am developing an application which involves putting a large number of
>listitems into a listview control. (A couple of thousand or so).

>Each time a new listitem is added, the entire listview repaints. This
>wouldn't be so bad if it only occured whilst filling those items which the
>user can see but even if the listitem being added is off the bottom of the
>listview, it still repaints itself causing an headache inducing flicker.

>Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
>but I think this may be a job for the WIN32 API.

>Thanks in advance,
>Chris.



Mon, 22 Jan 2001 03:00:00 GMT  
 ListView control flickers when adding new items
Set the newly added item to have selection.
If you dont do this every time you add an item the listbox will scroll back
to the currently selected item.
If you are adding a bunch of items to a new control the default is to scroll
to the beginning after each addition.

-Adam

Quote:
>I am developing an application which involves putting a large number of
>listitems into a listview control. (A couple of thousand or so).

>Each time a new listitem is added, the entire listview repaints. This
>wouldn't be so bad if it only occured whilst filling those items which the
>user can see but even if the listitem being added is off the bottom of the
>listview, it still repaints itself causing an headache inducing flicker.

>Anybody got any decent tips? I've tried ClipControls, AutoRedraw etc. etc.
>but I think this may be a job for the WIN32 API.

>Thanks in advance,
>Chris.



Tue, 23 Jan 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. ListView control flickers when adding new items

2. Q: How to get rid of ListView flicker when adding/removing items

3. How to prevent flickering of the previous selected item in a ListView

4. Any Way To Stop All ListView Items From Blinking While Adding Items

5. Adding Items to ListView Control.

6. adding new items to control box

7. Listview is flickering during Listitems.add

8. Listview is flickering during Listitems.add

9. Listview is flickering during Listitems.add

10. TreeView: flicker during adding new nodes

11. changing the background of a listview item in the listview control

12. Listview Control - moving items from one listview to another

 

 
Powered by phpBB® Forum Software