Sign in to follow this  
Followers 0
Ghost21

Print Server & Printer with now duplicate Servers

6 posts in this topic

I'm trying to list out in a treeview Print Servers and Printers without haveing duplicate servers listed..

So far this way seems to work

$hItem = _GUICtrlTreeView_FindItem($TreeView2, $PrintServer, True, 0)
                If $hItem = "" Then
                    $Printserver_TreeViewItem = GUICtrlCreateTreeViewItem($PrintServer, $TreeView2) ; Never found server then add..
                    $Printer_TreeViewItem = GUICtrlCreateTreeViewItem($printer, $Printserver_TreeViewItem)
                    If $IP <> "" Then
                        $IP_TreeViewItem = GUICtrlCreateTreeViewItem("IP: " & $IP, $Printer_TreeViewItem)
                    Else
                    EndIf
                Else
                    $Printer_TreeViewItem = GUICtrlCreateTreeViewItem($printer, $Printserver_TreeViewItem)
                    If $IP <> "" Then
                        $IP_TreeViewItem = GUICtrlCreateTreeViewItem("IP: " & $IP, $Printer_TreeViewItem)
                    Else
                    EndIf
                EndIf

But I find it slow when I'm loading 200 or more printers.. How can I speed this up ??

Share this post


Link to post
Share on other sites



Try this:

_GUICtrlTreeView_BeginUpdate($TreeView2)

; ... make all your updates

_GUICtrlTreeView_EndUpdate($TreeView2)

:unsure:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Try this:

_GUICtrlTreeView_BeginUpdate($TreeView2)

; ... make all your updates

_GUICtrlTreeView_EndUpdate($TreeView2)

:unsure:

Whats that do for it ?

Share this post


Link to post
Share on other sites

Every time you change something in the TreeView control, it takes the time to redraw the control. This causes the treeview to stop repainting until you are done changing things. See help file.

:unsure:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Ok but for the code above is that the most efficient way of displaying data ?

Share this post


Link to post
Share on other sites

It would also help if you created the complete list in an array or a delimited string, then loaded the items in the TreeView in one pass without the test for duplication in the loop. De-dup and sort the list in memory away from the GUI before you load the data to the control.

:unsure:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0