marc0v Posted March 23, 2013 Share Posted March 23, 2013 (edited) Hi,Here is a TreeView GUI with some functionalities (search, export to clipboard, change state of the tree...).Personally I use it to display some datas from the registry.Tested with : AutoIt 3.3.0.0, WinXP SP3 32 Bits, single monitor, 'Windows classic' (as Windows 95/98/2000) desktop themeI would be grateful if someone would be willing to test it in different environments than mine to see how it behaves.Things that could make the script not to work properly :* using an AutoIt script engine > 3.3.0.0 (However, I tried to make my script compatible with newer AutoIt versions)* running on another OS than WinXP* running on a 64 Bits OS (DllStruct or DllCall possible issues with 64 bits pointers/handles)* GUI problems with desktop themes (I only use the 'Windows classic' theme)* multiple monitors (for windows positionning, treeview items hit_test and rectangle)* things I did not think of...* and bugs of course...Known bugs :* memory usage increase by a few hundreds Kbytes everytime the treeview is reloaded (some memory leak...),as a workaround, after a hundred treeview reload, the program will restart itself to release the lost memory* small memory leak (~8 kb) on each tree reload* using a theme for the blinds with large fonts makes the bottom of the main GUI to disappearThe code is free to reuse/improve/adapt as you want.(This script, as I release it, does not write anything to the registry or the file system)Thanks for any testing or advice.Updated, 02 April 2013 :TreeViewGUI.zip :MD5 : DF0802EE21D458AA00DA839B235370BBSHA-1 : 3FF545F440E728B86D1688C56CF7FB3060DEB4EASHA-256 : 0D24C6D24808BE34EB8BC2A92218D6EB7B8209DF1B0AED6CB78943633814E320TreeViewGUI.zipscreenshots : Edited April 2, 2013 by marc0v iFFgen and UEZ 2 Link to comment Share on other sites More sharing options...
lorenkinzel Posted March 23, 2013 Share Posted March 23, 2013 Win7 x64 Autoit 3381No sparks or smoke (it works).No problems that I could notice. Link to comment Share on other sites More sharing options...
marc0v Posted March 23, 2013 Author Share Posted March 23, 2013 Thanks lorenkinzel, did you ran the script with AutoIt3.exe or AutoIt3_x64.exe, or both?(if you don't know, you can look in the Task Manager, when the script is running, to see which process is running : AutoIt3.exe or AutoIt3_x64.exe) Link to comment Share on other sites More sharing options...
KaFu Posted March 24, 2013 Share Posted March 24, 2013 Looks nice , I ran it on Win7 as 32bit and 64bit, both looking good at a first glance. Running at 64bit I've noticed the "TVINormSel.ico" to be missing for the currently selected node, did not show up at all. What kind of makes your script hard to read are those self-defined file-extensions (.AUC), I would suggest to stick to .au3. Also a thing I've learned the hard way too, I would suggest not to rip apart the standard UDFs for your own custom builds, this way you can not easily participate in version changes / bug-fixes etc., just stick to the standard UDFs. Regarding the memory leak, I think this might have to do with your mixing of the standard functions GUICtrlCreateTreeViewItem() with UDF functions and direct message sends. My guess is that the mem leak should be gone when you replace those standard function calls with the Treeview UDF ones (e.g. _GUICtrlTreeView_Add()). 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...
marc0v Posted March 24, 2013 Author Share Posted March 24, 2013 (edited) For the memory leak you're right, I must create the treeview items with _GUICtrlTreeView_Add instead of GUICtrlCreateTreeViewItem This way there's no memory leak, but I'll have to rewrite some parts of the code because : * items created with _GUICtrlTreeView_Add won't respond to GUICtrlRead($id_treeview) (to know which treeview item is currently selected) * I will get a handle instead of a CtrlID to work with these treeview items * _GUICtrlTreeView_Add will allow me to directly set the images for created treeview items (which may solve the "TVINormSel.ico" not appearing) Edit : now I've a problem, _GUICtrlTreeView_Add (and other UDF functions for items created this way) do not allow to set the text and background colors of each treeview item, which is a feature I really need. So, unless I get a way of coloring differently each treeview item, I will keep GUICtrlCreateTreeViewItem and GUICtrlSet(Bk)Color, with the memory leak... BTW (in 64bits mode), does clicking 'Clear Marks in Full Tree' makes the pink arrow appear? Or does un-commenting the following two lines 60&61 in 'ReadDatas.au3' solve this problem? ;DllStructSetData($t_tvitem_norm, "hItem", $h_sub_tvitem) ;_GUICtrlTreeView_SetItem($h_treeview, $t_tvitem_norm) Edited March 24, 2013 by marc0v Link to comment Share on other sites More sharing options...
water Posted March 24, 2013 Share Posted March 24, 2013 Great script! Works fine with AutoIt 3.3.8.1 and Windows 7. However I noticed that to expand/collapse it is sometimes (not always) needed to doubleclick the plus/minus. A single click always works if I click the dash right to the plus/minus. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
UEZ Posted March 24, 2013 Share Posted March 24, 2013 Very good work But why are the file extension of the includes different than au3 as already mentioned by KaFu?Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
marc0v Posted March 24, 2013 Author Share Posted March 24, 2013 To Water I get a similar behavior : when I single click on the +/- box (or slightly on the left, or on the right of it), the item always get expanded/collapsed when I single click far enough on the left of the +/- box, nothing happens, but if I double-click at the same spot the item is expanded/collapsed and if I go a little further on the left, the parent item gets collapsed This behavior also occurs in the Windows Explorer folders tree, so it must be something external to my script and even AutoIt... You could check in a Windows Explorer window (with the folders tree) if you get the same left-right offset. Well, your cursor icon (the mouse arrow) has a special 'hot-spot', a single pixel that defines where you've clicked if the 'hot-spot' is misplaced in your cursor icon, you'll get the impression that you are clicking on some place while you are in fact clicking a few pixels away. Link to comment Share on other sites More sharing options...
marc0v Posted March 24, 2013 Author Share Posted March 24, 2013 Thanks for all these compliments but we only get better by 'borrowing' some knowledge from the others to UEZ, I write AutoIt scripts inside a PSPad project (the PSPad editor has some good features despite a few bugs) PSPad (for syntax highlighting), and the Windows Explorer (for file opening), can be made to recognize .auc;.aul as AutoIt Files So it's simply a way of structuring my project more clearly. .AUC = AutoIt constants : PSPad highlight the content as an AutoIt script but does not allow to run or compile it .AUL = AutoIt function libraries : same as previous .UDF = UDF adapted function libraries : same as previous If you have some problem reading the code in Scite you can just rename .auc, .aul, .udf files to .au3 and correct the 6 include lines at the very beginning of the TreeViewGUI.au3 file. (next time I'll upload with .au3 extensions only) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 24, 2013 Developers Share Posted March 24, 2013 If you have some problem reading the code in Scite you can just rename .auc, .aul, .udf files to .au3 and correct the 6 include lines at the very beginning of the TreeViewGUI.au3 file. (next time I'll upload with .au3 extensions only) ... or just add this to your SciTEUser.properties: au3=*.au3;*.auc;*.AUL;*.inc Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
marc0v Posted April 2, 2013 Author Share Posted April 2, 2013 Bump for significant update. * Mostly solved the memory leak on tree reload, by deleting (GUICtrlDelete) the treeview control and re-creating it after (remains a ~8 kb memory leak on tree reload). * Improved speed on tree creation and tree operations. * Minor bug fixes and improvements. * More help in the TEST_TREE() function to customize the treeview (in ReadDatas.au3) : customization includes individual coloring, bolding, expanding, sorting of tree items. * More help in the 'Infos.ReadMe' file. 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