Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Treeview slow when refreshing its contents
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Treeview slow when refreshing its contents

 Post Reply Post Reply
Author
Message
od@eureka View Drop Down
Newbie
Newbie


Joined: 15 December 2009
Location: France
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote od@eureka Quote  Post ReplyReply Direct Link To This Post Topic: Treeview slow when refreshing its contents
    Posted: 15 December 2009 at 10:58am
I have to refresh the contents of a Treeview :
- by default, it show all values (approximativly 1500 nodes)
- when using filters, users can reduce the number of nodes to a subset of 150 or less
 
I do a small test:
 
        myTreeView.Nodes.Clear
        Dim i As Integer
        For i = 1 To 100
                    myTreeView.Nodes.Add Parent, xtpTreeViewChild, i, "line " & CStr(i), 3    
        Next
 
--> it is very slowly the 2nd or more times...(> 4 sec !!!)  How to do to go faster ? (the first time, for 1500 nodes, it takes only 1 sec )
Regards

Didier
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 December 2009 at 5:46am
Hi,
 
You can try WM_SETREDRAW API message:
 
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_SETREDRAW = &HB

Private Sub Command1_Click()
SendMessage myTreeView.hwnd, WM_SETREDRAW, 0, 0
myTreeView.Nodes.Clear
        Dim i As Integer
        For i = 1 To 1000
                    myTreeView.Nodes.Add Parent, xtpTreeViewChild, i, "line " & CStr(i), 3
        Next
       
SendMessage myTreeView.hwnd, WM_SETREDRAW, 1, 0
End Sub
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
od@eureka View Drop Down
Newbie
Newbie


Joined: 15 December 2009
Location: France
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote od@eureka Quote  Post ReplyReply Direct Link To This Post Posted: 16 December 2009 at 8:11am
 
Thank you for the solution that solves well the response time ...
 
But unfortunately, after several calls of myTreeView.Nodes.Clear(), I have an error code 80010108 ...
 
 --> Is there another way to empty the entire TreeView?
Regards

Didier
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2010 at 4:39am
I got the same error including crash of the application if i often use the clear-method.
It's faster and also save to remove the nodes, but from last node to first node !
Also use in this case the WM_SETREDRAW.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2010 at 8:22am
do you have last version, it was minor problem with Clear method but it have to be fixed in 13.2.x
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 06 January 2010 at 12:40pm
I'm still waiting for 13.2.2 now because i have actually no issues ;)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.