Listview is flickering during Listitems.add 
Author Message
 Listview is flickering during Listitems.add

Hello,

is there a way stop the flickering in the Listview during item adding?

Greetings Peter :-)



Sat, 28 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

Use API function LockWindowUpdate

Declaration looks like this:

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

Before adding the items call

    LockWindowUpdate( listview.hwnd )

Add your items
Now call

    LockWindowUpdate(0&)

Good Luck
Lars Markussen

Peter Friedrich skrev i meddelelsen ...

Quote:
>Hello,

>is there a way stop the flickering in the Listview during item adding?

>Greetings Peter :-)



Sat, 28 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

Peter,

Try using the following code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd
As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long

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

    Call SendMessage(Tree.hwnd, WM_SETREDRAW, REDRAWOFF, 0) ' Turn Paint Off
    Do While ...
        'Do your Tree-filling-thing here
    Loop
    Call SendMessage(Tree.hwnd, WM_SETREDRAW, REDRAWON, 0) ' Turn Paint On

Try to avoid the usage of DoEvents within the loop, it could cause repaints
in some cases.

Have fun,

Richard

Quote:

>Hello,

>is there a way stop the flickering in the Listview during item adding?

>Greetings Peter :-)



Sat, 28 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

My 2 cents:

ListView1.Visible=False
'Add items
ListView1.Visible=True

As long as your code executes the listview will not be erased, but the
screen will not be updated.
But rememeber to turn the Visible property to True again before finishing
with the current event,
otherwise the control WILL erase itself.

Quote:

> Hello,

> is there a way stop the flickering in the Listview during item adding?

> Greetings Peter :-)

?


Sat, 28 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

Hi Lars,

thanks for your support, but the LockWindowUpdate API doesn't change
anything.

Maybe other suggestions?

Greetings Peter :-)


Quote:
>Use API function LockWindowUpdate

>Declaration looks like this:

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



Sun, 29 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

Hi ,

thanks for your support, but the SendMessage API doesn't change anything.

Maybe other suggestions?

Greetings Peter :-)

R. Kuiper schrieb in Nachricht ...

Quote:


>>Hello,

>>is there a way stop the flickering in the Listview during item adding?

>>Greetings Peter :-)



Sun, 29 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

Hi,

Try listview1.enabled = false, the add items, then listview1.enabled = true.
Or
Listview1.visible = false, add items, then listview.visible = true

Personally, both the LockWindowUpdate and the SendMessage API call both work
for me :0)

Hope this helps!

Shawn

Quote:

> Hi ,

> thanks for your support, but the SendMessage API doesn't change anything.

> Maybe other suggestions?

> Greetings Peter :-)

> R. Kuiper schrieb in Nachricht ...


> >>Hello,

> >>is there a way stop the flickering in the Listview during item adding?

> >>Greetings Peter :-)



Sun, 29 Oct 2000 03:00:00 GMT  
 Listview is flickering during Listitems.add

My guess is that you want to update listview subitems without flickering try
this

public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As
Long

public Type LV_ITEM
   mask As Long
   Index As Long
   SubItem As Long
   State As Long
   StateMask As Long
   Text As String
   TextMax As Long
   Icon As Long
   Param As Long
   Indent As Long
End Type

public Const LVIF_TEXT As Long = 1

Sub SetItm(aStr As String, iIndex As Long, iCol As Long)

Dim lvi As LV_ITEM

With lvi
    .Index = iIndex
    .SubItem = iCol
   .Text = aStr
   .mask = LVIF_TEXT

    .TextMax = Len(aStr)
End With

Call SendMessage(frmLVStyles.ListView1.hWnd, LVM_SETITEM, 0&, lvi)

End Sub

I just copied some code from some of my application maybe you have to
laborate with the public statement
depending where you place the code

Best regards
Klas Hagelqvist



Tue, 31 Oct 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Listview is flickering during Listitems.add

2. Listview is flickering during Listitems.add

3. TreeView: flicker during adding new nodes

4. ListView.ListItems.ListItem Invalid Key error

5. ListView.ListItems.Add Question

6. HELP --- Adding ListItem to ListView always returns Error 13 - Type Mismatch

7. ListView.listItem.Add method problem

8. Listview control, Listitems.Add() Method, Error #35603

9. LISTVIEW - ADD EXTRA IMAGES TO LISTITEMS

10. Is ListView.ListItems.Add REALLY that slow??

11. adding listitems to a listview using api

12. LISTVIEW - ADD EXTRA IMAGES TO LISTITEMS

 

 
Powered by phpBB® Forum Software