Sign in to follow this  
Followers 0
KaFu

ShellTristateTreeView [Updated 2010-Aug-14]

24 posts in this topic

#1 ·  Posted (edited)

Hello Community,

I decided to release this collection of functions to create a Treeview browser as a standalone product because I hope to get some input for further improvements this way (esp. Vista and Win7 compatibility, as I don't have these OS installed). I utilize them in both my programs AMT and SMF (see sig).

ShellTristateTreeView

v39, 2010-Aug-14

post-40098-12486965353887_thumb.jpg

For sure the code itself is really dirty (e.g. the WM_NOTIFY needs unification), breaks any convention, and contains enough useless variables etc. pp...

But I'll be happy about any help offered to clean up this quiet complex piece of code and to learn ways to further improve these functions and to share them with the community >_< ...

Kudos to Holger Kotsch and R.Gilman (a.k.a. rasim) for (large) parts of the code, if you find portions written by yourself please let me know so that I can add you to the Kudos list :( ...

2009-Jul-27, v27

2010-Aug-14, v39

Regards

ShellTristateTreeView_v27.zip

ShellTristateTreeView_v39.zip

Edited by KaFu

Share this post


Link to post
Share on other sites



Thank you for posting KaFu! I'm trying to use your TreeView for a FTP sync tool. And the look and feel is almost exactly what I was looking for!

Share this post


Link to post
Share on other sites

Thanks for the nice feedback :P. Hmmm, my most recent version I use for SMF is v38 :blink:, but that's heavily in-cooperated into SMF. When the next release of that one is finished, I'll extract the relevant code and do an update to this one as well ;)...

Share this post


Link to post
Share on other sites

Perfect! Can't wait to see it. :blink:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

..having some trouble with running the example file. :blink:

When I run ShellTriStateTreeView_v27_Example it tells me that $TVM_GETITEM and $TVM_SETITEM are not declared. I added "Global $TVM_GetItem, $TVM_SetItem" but when I do that it won't go to the next screen and display the directories/files that I selected.

Any help would be appreciated. ;)

Edited by sliceofpie

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This is what I put into the example file to make it work.

If Not IsDeclared("TVM_GETITEM")    Then    Global Const $TVM_GETITEM   = 0x1100 + 12
If Not IsDeclared("TVM_SETITEM")    Then    Global Const $TVM_SETITEM   = 0x1100 + 13

Cheers! :blink:

Edited by sliceofpie

Share this post


Link to post
Share on other sites

Nice that you found the deviations ;), reason is that the script was coded with an older version of AutoIt. I'll update the snippet as soon as SMF is ready for a new release :blink:.

Share this post


Link to post
Share on other sites

I'm looking to display multiple variables i.e. each folder that is checked.

When I use the example below:

MsgBox(0, "", $aTreeViewItemState[0][0] & @CRLF & $aTreeViewItemState[0][0])

it returns the first directory twice. How can I display every directory that is checked?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Thanks Kafu! This works! :blink:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

When I run the Treeview browser, it creates a list of the folders I've selected and saves it to the ShellTristateTreeView.ini file. When I close the program and reopen, it will give me an error message "Array variable has incorrect number of subscripts or subscript dimension range exceeded." and I have to delete the .ini file in order for it to rerun. :)

The only time this doesn't happen is if I select the C:\ drive only.

;)

Edited by sliceofpie

Share this post


Link to post
Share on other sites

To be honest I don't know why that happens. I've attached the latest update in the first post. Check that out, should not have such problems.

Share this post


Link to post
Share on other sites

You are the man Kafu! The new update works beautifully! ;)

Share this post


Link to post
Share on other sites

why is the child items not chosen when the parent item has a tick?

Share this post


Link to post
Share on other sites

The child item does not exit until the tree-branch is expanded, I just check if there is at least one sub-item to add the +. On creation there should be a test if the parent is checked... which isn't currently there ;). Expand a tree, then collapse it again and you will see that the child items will be checked if they already exist.

I'll add it, but thats more a cosmetic thing. It won't change anything in the resulting array, because if the parent is checked the child items will not be returned at all.

Share this post


Link to post
Share on other sites

thanks for the update i have been looking for a nice treeview like this, great work.

Share this post


Link to post
Share on other sites

I'm trying to integrate the ShellTristateTreeView sample in a tab control. The problem is that treeview list shows up in every tab. Here's a sample of what I'd like to do.

GUICtrlCreateTab(1, 1, 305, 353)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("Tab1")

$c_TreeView_LocationFilter = _GUICtrlTreeView_Create($hGUI, 10, 30, 220, 280, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_CHECKBOXES, $TVS_NOTOOLTIPS), $WS_EX_CLIENTEDGE)

GUICtrlCreateTabItem("Tab2")

GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)

Share this post


Link to post
Share on other sites

I'm trying to integrate the ShellTristateTreeView sample in a tab control. The problem is that treeview list shows up in every tab. Here's a sample of what I'd like to do.

I end up using GUICtrlCreateTreeView instead of _GUICtrlTreeView_Create followed by GUICtrlGetHandle. This seems to be working.

Here's the link for the post:

http://www.autoitscript.com/forum/index.php?showtopic=56751&st=0&p=430278&hl=%20_GUICtrlTreeView_Create%20%20tab&fromsearch=1&#entry430278

Share this post


Link to post
Share on other sites

Hi Kafu.

Any updates on this yet? I'm working on a 64-bit OS and ShellTristateTreeView doesn't work properly with it. Do you have it for 64-bit?

Share this post


Link to post
Share on other sites

Hiho, it's part of the SMF source, there it's currently v43. As SMF is compiled only as 32bit (due to supporting 32bit dll's), I've never looked into the 64bit issue. But I assume it has to do with the dllstructure definitions used... oh, I see, and I use _ArraySortClib(), it's a machine-code function for very fast array sorting and sadly bound to 32bit, would need replacement too if the overall function should work on 64bit. Sorry, currently I'm not planning to implement compatibility.

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