KaFu Posted May 10, 2022 Share Posted May 10, 2022 Maybe using _GUICtrlTreeView_BeginUpdate ( $hWnd ) & _GUICtrlTreeView_EndUpdate ( $hWnd ) is beneficial here? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Nine Posted May 10, 2022 Share Posted May 10, 2022 (edited) @KaFu Just was thinking the same Here my searchItem to make it look faster : Func _searchitem() Local $sSearch = GUICtrlRead($sEARCHinput), $iFind = 0 GUICtrlSetData($edit_searchresult, "") For $i = 0 To UBound($aItems) - 1 If StringInStr($aItems[$i], $sSearch) Then GUICtrlSetData($edit_searchresult, StringSplit($aItems[$i], "#", 2)[1] & @CRLF, 1) _GUICtrlTreeView_Expand($idTreeView, $aPath[$i][1], True) _GUICtrlTreeView_SetSelected($idTreeView, $aPath[$i][1], True) If Not $iFind Then $iFind = $aPath[$i][1] ControlFocus($hGui, "", $idTreeView) _GUICtrlTreeView_SelectItem($idTreeView, $iFind) _GUICtrlTreeView_BeginUpdate($idTreeView) EndIf EndIf Next If $iFind Then _GUICtrlTreeView_EndUpdate($idTreeView) _GUICtrlTreeView_SelectItem($idTreeView, $iFind, $TVGN_FIRSTVISIBLE) EndIf EndFunc ;==>_searchitem Edited May 10, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
KaFu Posted May 10, 2022 Share Posted May 10, 2022 (edited) Or maybe this? Func _searchitem() Local $sSearch = GUICtrlRead($sEARCHinput), $iFind = 0 _GUICtrlTreeView_BeginUpdate($idTreeView) For $i = 0 To UBound($aItems) - 1 If StringInStr($aItems[$i], $sSearch) Then GUICtrlSetData($edit_searchresult, "", 1) GUICtrlSetData($edit_searchresult, StringSplit($aItems[$i], "#", 2)[1] & @CRLF, 1) _GUICtrlTreeView_Expand($idTreeView, $aPath[$i][1], True) _GUICtrlTreeView_SetSelected($idTreeView, $aPath[$i][1], True) If Not $iFind Then $iFind = $aPath[$i][1] ControlFocus($hGui, "", $idTreeView) _GUICtrlTreeView_SelectItem($idTreeView, $iFind) EndIf EndIf Next If $iFind Then _GUICtrlTreeView_SelectItem($idTreeView, $iFind, $TVGN_FIRSTVISIBLE) EndIf _GUICtrlTreeView_EndUpdate($idTreeView) EndFunc ;==>_searchitem Edited May 10, 2022 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Nine Posted May 10, 2022 Share Posted May 10, 2022 (edited) My idea was to show a first result as fast as possible, to make it look instantly, then do the rest in background. You can test it with a lot of matches, you will see the difference... Edited May 10, 2022 by Nine KaFu 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
KaFu Posted May 10, 2022 Share Posted May 10, 2022 Good idea, I do something like that in SMF too :), first parse the visible results of a listview enclosed by _GUICtrlListView_BeginUpdate() and _GUICtrlListView_EndUpdate(), and after that add the invisible results outside. Up to the Op which way to go. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
September Posted May 11, 2022 Author Share Posted May 11, 2022 LarsJ has a good example for coloring the items. Maybe can be referred. argumentum 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted May 11, 2022 Share Posted May 11, 2022 A possible change in search code : ; _GUICtrlTreeView_Expand($idTreeView, $aPath[$i][1], True) _GUICtrlTreeView_EnsureVisible($hTreeView, $aPath[$i][1]) For example, a search on "abv" would unnecessarily expand the 3rd match like this : Instead of the following (which seems more correct) : I just discovered that OP's original code was based on LarsJ's thread ("3) Semi-Virtual TreeView.au3") His examples 4) and 5) look very interesting, making the TreeView virtual. Nearly same code in 4) and 5) , except 5) uses a 100.000 rows text file. As I never approached the TreeView control (until the current thread) then it's time to begin KaFu 1 Link to comment Share on other sites More sharing options...
September Posted May 12, 2022 Author Share Posted May 12, 2022 Yes, I referred the 3) Semi-Virtual, as it's faster to build a treeview from a big txt file. the 4) virtual Treeview.au3 seems has some issues, if the .txt items like: The 2|001|0|20 and its child will lose. Also, the .txt file column 2, which is indicating how many child items under the parent, but if the original .txt format is below, it's hard to figure out the count in column 2, I don't have any idea to transfer it so far. aaaaaaaaaa bbbbbbbbbbb cccccccccc ddddddddddddddd eeeeeeeeeeeeee ffffffffffffff gggggggggggg hhhhhhhhhhhh iiiiiiiiiiii jjjjjjjjjjjj kkkkkkkkkkkk llllllllllll nnnnnnnnnnnn Link to comment Share on other sites More sharing options...
pixelsearch Posted May 12, 2022 Share Posted May 12, 2022 @September I wish LarsJ was here to respond your question but it's been several months he's not on the Forum. The code he presented for his virtual treeview (examples 4 & 5) seem to work only when children are created at the same sublevel, then the next node expands to a higher level etc... until it comes back to the root for a new cycle. After children were created at a certain level, all items created at a lower level don't seem to show. Maybe he did this purposely, or it's a bug which could be fixed when he comes back. So what works with this text file in example 3 ("semi virtual treeview") ... ... doesn't seem to work when applied to his virtual treeview code, as showed in your precedent post. Here is a shorter example of the issue, where item3 doesn't show because it's placed at a lower level (1) when children have already been created at a higher level (item2 at level 2) While waiting for LarsJ's return, if someone has an idea about this possible issue, thanks for sharing your thoughts. 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