Ghost21 Posted May 6, 2011 Share Posted May 6, 2011 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 ?? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 6, 2011 Share Posted May 6, 2011 Try this: _GUICtrlTreeView_BeginUpdate($TreeView2) ; ... make all your updates _GUICtrlTreeView_EndUpdate($TreeView2) 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 Link to comment Share on other sites More sharing options...
Ghost21 Posted May 6, 2011 Author Share Posted May 6, 2011 Try this: _GUICtrlTreeView_BeginUpdate($TreeView2) ; ... make all your updates _GUICtrlTreeView_EndUpdate($TreeView2) Whats that do for it ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 6, 2011 Share Posted May 6, 2011 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. 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 Link to comment Share on other sites More sharing options...
Ghost21 Posted May 6, 2011 Author Share Posted May 6, 2011 Ok but for the code above is that the most efficient way of displaying data ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 7, 2011 Share Posted May 7, 2011 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. 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now