-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Its very odd.
I do not have Multiselect enabled.
I have just put my SendMessage test button and code into your ShellTreeDemo and it works ok there, so it must be a property or something in my test app that is the issue. I will investigate. I am a bit busy tomorrow so it might take an extra day to do this.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Sorted, sort of.
I had SingleClickExpand set True and this is the cause of my problem.
This was my mistake as I did not read your property description and so misunderstood what this property does.
However it does not appear to do what it says...I can still expand multiple parts of the tree even when it is set to true???
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Ok, I found the issue.
SingleClickExpand is False by default, which it triggering code that blocks the expand. (Please turn on dbg_PrintToImmediate, it logs exactly what happened :) I don't have the print to file functionality to log in the exe in it though... will add next version.)
The whole functionality around that setting is a mystery I can't recall... since it doesn't expand in a single click if that setting is True anyway. But it's obviously a bug fix code that was stopping unwanted expansions. So I don't recall what was happening, will have to look into it. For now, since SingleClickExpand doesn't do anything (at least with a manifest, didn't check without cc6), it's ok to turn it on. (Or does it? Didn't check Win7 maybe that's it.)
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
ok, away now, should be able to find some time late tomorrow.
We are putting a lot of nitty gritty test detail into this thread, is that ok? or should we do this detail by email and only post the conclusions?
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
I was going too fast yesterday and trying to do several things at once (and failing).
As you say SingleClickExpand needs to be True (not False) for the SendMessage to work, and it does not do anything else and does not implement a single click expand which might well be an undesirable feature, so all is well.
Also I had confused this with SingleExpand which allows only one node to be expanded, but this also appears not to work and is probably also not a useful feature so not worth investigating???
Maybe these were both options that Microsoft thought about implementing then decided best not to?????
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Oh weird...
If I turn on SingleExpand, SingleClickExpand works when enabled, and then SingleExpand works as advertised; clicking on an item in same level expands that one and collapses the other. But only if you click the item name, using the expando buttons will open multiple. All that code I have in item click and expand revolving around this no doubt relates to this somehow... I'm really going to have to do a review of how these options behave and interact with/without ComCtl6 and Win7 vs Win10.
But for now be advised I was incorrect; if both of those options are True, it will change the behavior and do as the option names indicate.
It's fine to keep posting in the thread if you want to; others could be encountering similar issues, or related issues in the future where some of the info posted is helpful. Like knowing they're not going crazy when those two options don't work one at a time, but do together.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
You know much more than me, but I suspect that there are many weird, random and undocumented behaviours is these parts of Windows.
Maybe this is why LogicNP withdrew from this business? though I suspect issues with Win10 updates breaking their software was also an issue.
I think you are now the only one with viable ShellBrowsing components for COM (plus maybe Exontrol but theirs have a lot of limitations).
Maybe just need to concentrate on the core functionality for now and note that some of the more obscure features are "not currently supported"??. This is what Microsoft themselves do??
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Is it easy/viable to display Win10 style "Quicklinks" in the ucTree?
How can I set the initialpath to "ThisPC" ?
How can I set the Browserpath in ShellBrowse (and hence the linked ucTree) to either ThisPC or Desktop?
In my file dialogs I try to set the path to that used in the most recent load/save operation and persist this, but need to default to either Desktop or ThisPC if that path is no longer valid.
The LogicNP controls have a "ResettoDesktop" method, but defaulting to ThisPC might be a nicer option.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
As the initial path or as the root?
There's an option ComputerAsRoot to make it the root (same on ucShellBrowse for the dropdown).
For other places you enter a path, or to do this manually, and for other special locations without normal paths, it's done by using the GUID that identifies it.
ThisPC is ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}. If you Google that, you'll find it on lists with other locations.
Since it's asking the Windows shell, you can use whatever the shell accepts... enter the above in the Run... command or the Explorer address bar, and you'll find you're also taken to This PC.
--
I'm inclined to leave all options available, since you never know what OS it's being used on... a lot of people run 7 still (and honestly I'm fed up with 10 to the point I'm going to sell my brand new hardware if my next attempt to make 7 boot on it fails too). But I have been adding options that restrict things from being available during if the user wants... like that Content view on ucShellBrowse is a mess, I thought I had it off by default but I guess I left it on. So I had a UserOption flag, then eventually added a Property where any view could be restricted. I will try to make sure the default settings are stable across all Windows versions.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Thanks
Just after posting above I had a try at browsing to the "ThisPC" GUID and it works fine.
I'm committed to Windows10 (and I suppose soon 11). I held out with both 98 (my favourite) and XP for a long time but have now accepted that its just too difficult fighting against Microsoft. I like a lot of Win10, my only big concern is the frequent automatic updates and the real possibility that one will break my software which is all in VB6. One update did break things but it was the LogicNP shellbrowser that was to blame, and that's written in C++.
This is partly why I am keen to use your Shell Browser, the source code is available so if an update does break it then there is at least a chance that it might get fixed, even if you don't want to do it yourself.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
There's now a Beta release of a 64bit-compatible version of this control for twinBASIC. Requires tB Beta 207 or newer.
More info, download, and browse source on GitHub.
ucShellBrowse will take a bit longer, it's much more complex and impacted severely enough by current limitations of tB UserControl support that it doesn't run properly yet. Hopefully soon :)
-
ItemCheck event not triggered
VB6SP6
Win10x64
Im testing your ucShellTree v2.7 control and i found 2 bugs:
ItemCheck bug:
I want to uncheck a user-checked folder item in the event ItemCheck but this event is never triggered when i click on a checkbox.
Tri-State Bug:
The control .Checkboxes property is set to false. After i set .Checkboxes = True in the form_load the control switches through all 3 states (Check, Partial, uncheck) when im clicking on the checkbox. This doesnt happen when the control .Checkboxes property is True and not set by code.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
The checkbox should only be set to partial by the autocheck feature... can you describe how to reproduce this? (If it is set in this manner; it's cosmetic only, there's no current option to enable autocheck but not have cosmetic partial checks).
You can disable AutoCheck but I can't remember if I handled path reporting 100% correct for that.
(Verify that ExclusionChecks is False, if it's True that adds a 3rd user-selectable check)
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
control property values:
Code:
Autocheck=false
Checkboxes=false
ExclusionChecks=false
Form_load:
Code:
ucTree.Checkboxes = True
Clicking on a checkbox switches between "Check, Partial & Uncheck"...
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
i found another bug:
auto check of sub items works not correct.
1. I check a folder and after that i expand the folder. Now all sub items are checked (folders AND files).
2. I expand a folder and now i check the folder. No sub items are checked.
control property values:
Code:
Autocheck=false
Checkboxes=TRUE
ExclusionChecks=false
ShowFiles=TRUE
BTW: How to select single folders without the auto check of all sub items?
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
Mith
i found another bug:
auto check of sub items works not correct.
BTW: How to select single folders without the auto check of all sub items?
U can fix the AutoCheck-bug in the Sub "TVExpandFolder":
Before:
Code:
If bFav Then
TreeView_SetCheckStateEx hTVD, hitemPrev, 0
Else
If TreeView_GetCheckState(hTVD, hitemParent) = 2 Then
TreeView_SetCheckState hTVD, hitemPrev, 1
End If
End If
Fixed:
Code:
If bFav Then
TreeView_SetCheckStateEx hTVD, hitemPrev, 0
Else
If TreeView_GetCheckState(hTVD, hitemParent) = 2 Then
If mAutocheck = True Then
TreeView_SetCheckState hTVD, hitemPrev, 1
End If
End If
End If
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Thanks, will include that fix in next release and credit you for it.
Sorry if I'm having a little trouble following, it seems like that should resolve all issues here? Or was there still an issue? (Checking all items when expanding a checked folder when autocheck = true is by design; the parent being checked implies the children are checked. If you uncheck a child after that, the parent should change to partially checked).
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Sorry if I'm having a little trouble following, it seems like that should resolve all issues here?
No. The Tri-State-bug is still alive. See my posting https://www.vbforums.com/showthread....=1#post5630320 to reproduce it.
Quote:
Originally Posted by
fafalone
(Checking all items when expanding a checked folder when autocheck = true is by design; the parent being checked implies the children are checked. If you uncheck a child after that, the parent should change to partially checked).
BUT Autocheck is set to FALSE! See Post https://www.vbforums.com/showthread....=1#post5630321
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
The only workaround for the Tri-State-bug is currently to set checkboxes=true at the control properties and not in the code.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Hmm, definitely odd behavior and I'll need to study it more in depth. As a temporary solution, this should override it by detecting the switch into partial when Autocheck = False, then advancing it to cleared. This won't work if ExclusionChecks = True.
In ShellTreeSubclassProc, go to the handler for TVM_ITEMCHANGEDW, change:
Code:
ElseIf ((nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H3000) And (mAutocheck = False) Then
DebugAppend "ItemExclude"
TVEntries(nmtvic.lParam).Checked = False
TVEntries(nmtvic.lParam).Excluded = True
to
Code:
ElseIf ((nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H3000) And (mAutocheck = False) Then
DebugAppend "ItemExclude"
If mExCheckboxes Then
TVEntries(nmtvic.lParam).Checked = False
TVEntries(nmtvic.lParam).Excluded = True
Else
SetTVItemStateImage nmtvic.hItem, tvcsEmpty
End If
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Code:
ElseIf ((nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H3000) And (mAutocheck = False) Then
DebugAppend "ItemExclude"
If mExCheckboxes Then
TVEntries(nmtvic.lParam).Checked = False
TVEntries(nmtvic.lParam).Excluded = True
Else
SetTVItemStateImage nmtvic.hItem, tvcsEmpty
End If
Confirmed. These changes resolve the Tri-State-Bug when setting .Checkboxes = True in the code (control properties: Autocheck=false, Checkboxes=false, ExclusionChecks=false)
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Sorry, but i found another bug :-)
control properties:
Code:
Autocheck=false
Checkboxes=True
ExclusionChecks=false
Form_Load:
Code:
ucTree.Checkboxes = False
MSDN TVS_CHECKBOXES Description:
Quote:
Once a tree-view control is created with this style, the style cannot be removed. Instead, you must destroy the control and create a new one in its place.
You have to rebuild the treeview again in the "Public Property Let Checkboxes" if set to FALSE. Destroy the TV and call "InitTV" again?
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
i found some more bugs while testing the control:
1. ExpandZip is set to false but the zip file stills expands.
2. ItemClick event: the variable bFolder returns True if i click on a ZIP file.
control properties:
Code:
ExpandZip=false
ShowFiles=True
Autocheck=false
Checkboxes=false
ExclusionChecks=false
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
Mith
2. ItemClick event: the variable bFolder returns True if i click on a ZIP file.
Fix:
Func "ucWndProc", Case NM_CLICK, Case NM_RCLICK
Code:
Dim b_isFolder As Boolean
If TVEntries(tVI.lParam).bZip = True Then
b_isFolder = False
Else
b_isFolder = TVEntries(tVI.lParam).bFolder
End If
RaiseEvent ItemClick(TVEntries(tVI.lParam).sName, TVEntries(tVI.lParam).sFullPath, b_isFolder, MK_LBUTTON, tvhti.hItem)
RaiseEvent ItemClickByShellItem(siSelected, TVEntries(tVI.lParam).sName, TVEntries(tVI.lParam).sFullPath, b_isFolder, MK_LBUTTON, tvhti.hItem)
Now the variable bFolder returns False for ZIP files.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
No need to apologize for bug reports-- I'm sorry they're needed, but I definitely want to get them so I can fix it.
--
Post 82-- Try .RefreshTreeView() after changing the check; that destroys and recreates-- I spent tons of time working out how to restore the expansion states of the filesystem too, so it won't go back to startup state (if you want that, .ResetTreeView). I'll add in routine to this automatically if transitioning from checked to unchecked.
Post 83-- If ShowFiles = False, I can't reproduce this-- it correctly excludes zip files. If ShowFiles = True, then it's by design-- perhaps it's not the best name; ExpandZip is more along the lines of 'treat zip as folder'; I hadn't set it up to treat a zip as a file but block expansion anyway.
Post 84 - This is the same design issue. If ExpandZip is True, a zip *should be* reported as a folder (as Explorer does). I'll modify that block to check that setting, but it will still return bFolder = True when ExpandZip = True.
---
Actually, try this:
In TVAddItem, prior to TVEntries(nCur).sFullPath = sFPP, add this block:
Code:
If (mShowFiles = True) And (mExpandZip = False) Then
If (bFolder = True) And (bZip = True) Then
bFolder = False
End If
End If
Also add that in TVExpandFolder, just before TVEntries(nCur).sFullPath = LPWSTRtoStr(lpFull)
That should resolve issues globally instead of just at the click spot, because it impacts drag/drop too.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Code:
If (mShowFiles = True) And (mExpandZip = False) Then
If (bFolder = True) And (bZip = True) Then
bFolder = False
End If
End If
Your code snippet fixed the problem for ShowFiles=True & ExpandZip=false. The variable bFolder returns now True in the ItemClick event if i click on a ZIP file.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Post 82-- Try .RefreshTreeView() after changing the check; that destroys and recreates-- I spent tons of time working out how to restore the expansion states of the filesystem too, so it won't go back to startup state (if you want that, .ResetTreeView). I'll add in routine to this automatically if transitioning from checked to unchecked.
I tried both (RefreshTreeView & ResetTreeView) and they don't remove the checkboxes in the the control:
Code:
control properties: Checkboxes = True
Private Sub Form_Load()
ucTree.Checkboxes = False
'ucTree.RefreshTreeView
ucTree.ResetTreeView
End Sub
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Event bug:
You only raise the event "ItemCheck" if Autocheck=True. See unWndProc -> TVN_ITEMCHANGEDW.
The event "ItemCheck" should also raised if AutoCheck=False.
Fix:
Add this line:
Code:
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, CLng(Abs(TVEntries(nmtvic.lParam).Checked)), nmtvic.hItem)
to ucWndProc -> TVN_ITEMCHANGEDW
Code:
If (nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H1000 Then
TVEntries(nmtvic.lParam).Checked = False
TVEntries(nmtvic.lParam).Excluded = False
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, CLng(Abs(TVEntries(nmtvic.lParam).Checked)), nmtvic.hItem)
ElseIf (nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H2000 Then
TVEntries(nmtvic.lParam).Checked = True
TVEntries(nmtvic.lParam).Excluded = False
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, CLng(Abs(TVEntries(nmtvic.lParam).Checked)), nmtvic.hItem)
What about &H3000 and &H4000?
-
ucTree Enhancement "ShowOnlyFileCheckboxes"
ucTree Enhancement "ShowOnlyFileCheckboxes"
Situation:
A user should select some files via checkboxes but not select any folders via the checkboxes.
Solution:
A solution could be to show checkboxes only for files using a control property like "ShowOnlyFileCheckboxes".
Current solution:
Currently i modified the ItemCheck event to respond to changes of the variable fCheck to change back the Check-State if necessary:
Code:
ucWndProc -> TVN_ITEMCHANGEDW
If (nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H1000 Then
TVEntries(nmtvic.lParam).Checked = False
TVEntries(nmtvic.lParam).Excluded = False
i = CLng(Abs(TVEntries(nmtvic.lParam).Checked))
lSel = i
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, lSel, nmtvic.hItem)
If lSel <> i Then
TVEntries(nmtvic.lParam).Checked = True
SetTVItemStateImage nmtvic.hItem, tvcsChecked
End If
ElseIf (nmtvic.uStateNew And TVIS_STATEIMAGEMASK) = &H2000 Then
DebugAppend "ItemCheck"
TVEntries(nmtvic.lParam).Checked = True
TVEntries(nmtvic.lParam).Excluded = False
i = CLng(Abs(TVEntries(nmtvic.lParam).Checked))
lSel = i
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, lSel, nmtvic.hItem)
If lSel <> i Then
TVEntries(nmtvic.lParam).Checked = False
SetTVItemStateImage nmtvic.hItem, tvcsEmpty
End If
Code:
Private Sub ucFiles_ItemCheck(sName As String, sFullPath As String, bFolder As Boolean, fCheck As Long, hItem As Long)
If bFolder = True And fCheck = 1 Then
fCheck = 0 ' dont allow check folders & others
End If
End Sub
What do you think?
-
1 Attachment(s)
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
Mith
I tried both (RefreshTreeView & ResetTreeView) and they don't remove the checkboxes in the the control:
Code:
control properties: Checkboxes = True
Private Sub Form_Load()
ucTree.Checkboxes = False
'ucTree.RefreshTreeView
ucTree.ResetTreeView
End Sub
Try this:
Code:
Public Sub HardResetTreeView()
If Ambient.UserMode Then
DestroyWindow hTVD
pvCreate
End If
End Sub
Public Sub HardRefreshTreeView()
'Resets to the root then expands all the previous locations
'The lengthy code involves minimizing the OpenToPath calls by calculating
'smallest group of folders that will give us the same setup. E.g.:
'C:\a\b\(c,d,e,f) will call only C:\a\b\c, and not d,e,f or C:\a or b, because
'expanding to c will give us a b d e and f too
Dim i As Long
Dim sData() As String
If CalcRefreshData(sData) Then
HardResetTreeView
For i = 0 To UBound(sData)
OpenToPath sData(i), False
Next i
End If
OpenToPath sSelectedItem, False, True
Exit Sub
e0:
DebugAppend "PruneParentsFromRPL.Error->" & Err.Description & "(0x" & Hex$(Err.Number) & ")"
End Sub
Quote:
You only raise the event "ItemCheck" if Autocheck=True. See unWndProc -> TVN_ITEMCHANGEDW.
The event "ItemCheck" should also raised if AutoCheck=False.
Good catch-- I think you should have it *only* at the spots your fix puts, otherwise it would fire twice when AutoCheck = True. Will include in next release, thanks.
&H3000 and &H4000 are partial check and exclusion check; they shouldn't raise a check event. Perhaps a new event should be added for ItemExclude, but it really shouldn't be a check event.
Quote:
A user should select some files via checkboxes but not select any folders via the checkboxes.
You're of course welcome to modify ucShellTree but I think that's going a little beyond scope-- you'd be better off pairing a ucShellTree with ucShellBrowse; you could set the latter to turn off the top bar, hide folders, and show checkboxes, with the folder tree to the side for navigation.
Like this, but with Checkboxes = True for the ucShellBrowse control:
Attachment 190188
-
helper function addon
I added a useful helper function to the control:
Code:
Public Property Get CheckedPathCount() As Variant
CheckedPathCount = GetCheckedPathCount
End Property
Private Function GetCheckedPathCount() As Long
Dim i As Long
Dim lCount As Long
lCount = 0
For i = 0 To UBound(TVEntries)
If (TVEntries(i).Checked = True) And (TVEntries(i).bDeleted = False) Then
lCount = lCount + 1
End If
Next i
GetCheckedPathCount = lCount
End Function
This helps to decide e.g. to enabled or disabled a OK-button on a dialog window.
Do you have any explanation why i can't return a LONG with this helper function? The control crahses when i return a LONG...
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
You're of course welcome to modify ucShellTree but I think that's going a little beyond scope-- you'd be better off pairing a ucShellTree with ucShellBrowse; you could set the latter to turn off the top bar, hide folders, and show checkboxes, with the folder tree to the side for navigation.
http://www.vbforums.com/images/ieimages/2017/10/1.jpg
That's not possible, because the user must have the possibility to select files from different directories/drives. Thats the reason i switched from CommonDialogs to this ShellTree!
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Good catch-- I think you should have it *only* at the spots your fix puts, otherwise it would fire twice when AutoCheck = True. Will include in next release, thanks.
How about to add this before the event-raise for check/uncheck?
Code:
if AutoCheck = false then
i = CLng(Abs(TVEntries(nmtvic.lParam).Checked))
lSel = i
RaiseEvent ItemCheck(TVEntries(nmtvic.lParam).sName, TVEntries(nmtvic.lParam).sFullPath, TVEntries(nmtvic.lParam).bFolder, lSel, nmtvic.hItem)
If lSel <> i Then
TVEntries(nmtvic.lParam).Checked = True
SetTVItemStateImage nmtvic.hItem, tvcsChecked
End If
end if
-
BorderStyle property bug
I found another bug:
The change of the control property BorderStyle isnt stored because at UserControl_ReadProperties you read the property with the name "Border" but you save the property with the name "BorderStyle".
Easy to fix :bigyello:
-
Re: helper function addon
Quote:
Originally Posted by
Mith
I added a useful helper function to the control:
Code:
Public Property Get CheckedPathCount() As Variant
CheckedPathCount = GetCheckedPathCount
End Property
Private Function GetCheckedPathCount() As Long
Dim i As Long
Dim lCount As Long
lCount = 0
For i = 0 To UBound(TVEntries)
If (TVEntries(i).Checked = True) And (TVEntries(i).bDeleted = False) Then
lCount = lCount + 1
End If
Next i
GetCheckedPathCount = lCount
End Function
This helps to decide e.g. to enabled or disabled a OK-button on a dialog window.
Do you have any explanation why i can't return a LONG with this helper function? The control crahses when i return a LONG...
Try ()?
Code:
Public Property Get CheckedPathCount() As Long
CheckedPathCount = GetCheckedPathCount()
End Property
I've seen some weird bugs around () before.
Quote:
That's not possible, because the user must have the possibility to select files from different directories/drives. Thats the reason i switched from CommonDialogs to this ShellTree!
Strictly speaking it would be; you'd just cache the check status on your end to combine from multiple folders and restore it if needed. But yes ucShellTree is better for this. You could in theory remove the checkboxes from folders by setting the state image index to 0... it would require some doing, I'll look into it as a feature for next version. I'll be doing big work on these controls again soon now that twinBASIC's new version is out (ucShellTree is currently not working on it so not for another few days).
Quote:
How about to add this before the event-raise for check/uncheck?
Was there an issue with how I was going to set it up? I haven't tested it yet, no time right now.
-
Feature request: "ShowHiddenFileExtensions"
Feature request: "ShowHiddenFileExtensions":
Your control supports ShowHiddenItems & ShowSuperHidden but i miss a property to enable the forced display of file extensions to override the system settings of the windows explorer.
Is that possible?
-
VB crashes using the control as an OCX
VB6SP6 Win10x64
I compiled your control as an OCX and use binary compatibility to avoid multiple ClassIDs for each new compiled OCX.
Now VB6 crashes everytime when i start my test project in the IDE and a form with the control is displayed.
This also happens when i run the test project as an compiled EXE.
I get no crash if i open the form with the control in the IDE and edit some properties.
Info: No crash happens if i compile the OCX without any compatibility but this no pratical solution.
How to use the ShellTree as an OCX with binary compatibility?
-
Re: Feature request: "ShowHiddenFileExtensions"
Quote:
Originally Posted by
Mith
Feature request: "ShowHiddenFileExtensions":
Your control supports ShowHiddenItems & ShowSuperHidden but i miss a property to enable the forced display of file extensions to override the system settings of the windows explorer.
Is that possible?
Certainly possible; ucShellBrowse has such an option. Just takes a bit of work to set up correctly; you can't just switch the name queried for everything because then you wind up showing extensions that should be hidden even when extensions are shown (e.g. .lnk on shortcuts) and GUIDs for some virtual items.
Quote:
How to use the ShellTree as an OCX with binary compatibility?
I really don't know too much about this since I never use them as ocx myself beyond test compiles; I think it's a general issue rather than ucShellTree-specific so a thread about it might get some answers; you may need to unregister and delete the previous versions if you want to compile with binary compatibility, because I think that problem arises when you compile it and it's *not* actually compatible.
-
Re: Feature request: "ShowHiddenFileExtensions"
Quote:
Originally Posted by
fafalone
I really don't know too much about this since I never use them as ocx myself beyond test compiles; I think it's a general issue rather than ucShellTree-specific so a thread about it might get some answers; you may need to unregister and delete the previous versions if you want to compile with binary compatibility, because I think that problem arises when you compile it and it's *not* actually compatible.
I posted a question to the VB6 group: OCX crashes when compiled with binary compatibility
But i guess it have something to do with your code because i use a lof of OCXs with binary compatibility and never had any issue until today.
I guess i will add debug code to the OCX to check where exactly the OCX crashes. Stay tuned for the result...
-
Re: Feature request: "ShowHiddenFileExtensions"
The compiled OCX with binary compatibility crashes in the function CreateTreeView at the line CreateTreeView = CreateWindowEx(...)
Code:
Private Function CreateTreeView(hwndParent As Long, _
iid As Long, _
dwStyle As Long, _
dwExStyle As Long) As Long
DebugToFile "CreateTreeView_Start"
Dim rc As oleexp.RECT ' parent client rect
Call GetClientRect(hwndParent, rc)
DebugToFile "CreateTreeView_1"
' Create the TreeView control.
CreateTreeView = CreateWindowEx(dwExStyle, WC_TREEVIEW, "", _
dwStyle, 0, 0, rc.Right, rc.Bottom, _
hwndParent, iid, App.hInstance, 0)
DebugToFile "CreateTreeView_End"
End Function
Debug values before CreateWindowEx:
Code:
dwStyle: 1350638121
rc.Right: 297
rc.Bottom: 340
hwndParent: 3348196
iid: 100
App.hInstance: 285212672
Do you have any idea whats going on?
-
2 Attachment(s)
Double trouble folder display bug
I found another bug:
The folder "C:\test1" is root but showed again inside himself as a sub folder:
ShellTree:
Attachment 190204
Windows Explorer:
Attachment 190205
Code to reproduce:
Code:
ucTree.CustomRoot = "C:\test1"
ucTree.OpenToPath "C:\test1", True
Solution:
Avoid using OpenToPath with a path that is used as CustomRoot or add this to the OpenToPath function:
Code:
if OpenToPath = CustomRoot then Cancel OpenToPath
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Yeah I didn't put in too many checks against the user shooting themselves in the foot :D But I'll add that check.
-
2 Attachment(s)
Check/Uncheck item visually select issue
Check/Uncheck item visually select issue
A item isnt selected when checking or unchecking the item.
Here i checked the item "DVD" but the item "Boot" is still selected:
Attachment 190214
IMHO it should be like this:
Attachment 190215
How can i select the item in the ItemCheck event using the variable hItem?
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
TreeView_SetItemState hTVD, hItem, TVIS_SELECTED, TVIS_SELECT
But I definitely wouldn't want that behavior so if I add it, it would be a default-off option. Note it's probably going to trigger all the code that fires when you click the item; if it does, to avoid it you'd have to set a module-level flag like 'bIgnoreThisSelection' and set it before then clear it after, then wrap all the selected item code in it.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
TreeView_SetItemState hTVD, hItem, TVIS_SELECTED, TVIS_SELECT
I tried it with SendMessage inside the ItemClick event but it doesnt work:
Code:
Public Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub ucTree_ItemCheck(sName As String, sFullPath As String, bFolder As Boolean, fCheck As Long, hItem As Long)
Const TV_FIRST = &H1100
Const TVM_SELECTITEM = (TV_FIRST + 11)
Const TVGN_CARET = &H9
Debug.Print "hWndTreeView:"; ucTree.hWndTreeView
Debug.Print "hItem:"; hItem
Debug.Print SendMessageAny(ucTree.hWndTreeView, TVM_SELECTITEM, TVGN_CARET, hItem)
End Sub
Debug values:
Code:
hWndTreeView: 4659090
hItem: 230647432
0
Strange, you use the same SendMessage call in the CTL to select an item but in the ItemClick event it doesnt work.
Any ideas?
-
Create new folder
The SHBrowseForFolder dialog supports the creation of new folders in the tree.
Is this somehow possible with ucShellTree too?
e.g. add a new TreeViewItem and start the Label edit mode to set the name of the new folder.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Thought I added that already... guess not... ucShellBrowse can... Will do. Going to need a few days though my Windows install went insane I'm going to be down a couple days for a reinstall, can't do any serious programming on my tablet.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Going to need a few days though my Windows install went insane I'm going to be down a couple days for a reinstall, can't do any serious programming on my tablet.
Install and use VB6 inside a virtual machine like VMware. Easy to reset to the default installation. No heavy reinstallation & configuration of your dev environment needed :)
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
I have tB on my tablet its just a pain to use and im focused on fixing things. I'm done backing up files and making install media so hopefully by tonight; vb6 and tB get reinstalled first.
-
1 Attachment(s)
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Expanding a zip when ShowFiles = True is by design; as I explained it's more of a poorly named property issue.
What I'll do for you is add a module level property,
mNeverExpandZip, in the User Options section up top below the changelog.
Then in TVExpandFolder,
and in TVAddItem,
How can i display the .ZIP extension in the tree?
Attachment 190271
For the user it is confusing without the file extension.
The first and second zip file looks like a folder and the 3. zip file looks like a txt file...
my ucShellTree properties:
Code:
ShowFiles = True
mNeverExpandZip = True
ExpandZip = False
i guess something like this should be added:
Code:
if ShowFiles = True AND mNeverExpandZip = True AND ExpandZip = False then ShowZipExtension=True
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Hiding extensions is one of the worst default settings of Windows ever yet they've refused to correct that for decades despite being bad for usability and worse for security.
The option to always show extensions or use explorer will be in the next version. If you want to test if it's working right for me and/or backport from tB to VB6, https://github.com/fafalone/ShellCon...ellTree2-9-2-a
If you're still refusing to join us in the future, you can view ucShellTree.twin as text in the browser, it's the source code file for the control.
The changes are much more substantial than the others; a lot more sections had to be changed and rearranged for this, too many to put into this post.
Code:
'v2.9.2 (ALPHA, 29 Jan 2024)
'-New FileExtensions property to choose between following Explorer's setting for hiding
' known extensions, over forcing them to always show.
'
'-Added property CheckedPathCount.
'
'-Added UserOption mNeverExpandZip, to prevent expansion of .zip when ShowFiles = True.
'
'-(Bug fix) Border property not restored correctly due to re-reading it with the wrong
' name from the property bag.
'
'-(Bug fix) Opening to a custom root would add the root as a child of itself.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
If you're still refusing to join us in the future, you can view ucShellTree.twin as text in the browser, it's the source code file for the control.
The changes are much more substantial than the others; a lot more sections had to be changed and rearranged for this, too many to put into this post.
I transfered all your changes from the Twinbasic control to the VB6 control but now i see that your changes make it impossible to use them in the VB6 CTL file.
You added Krool's subclassing and this requires the use of an external module for the subclassing functions. The use of the AddressOf operator doesnt work if the sublass functions are not in a module...
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
I use not only ucShellTree as a ctl exclusively, but also Krool's VBCCR and VBFlexGrid controls, exclusively, as ctl. I assure you it's not impossible, it just requires having a standard module as a helper.
But the method of subclassing isn't of particular importance. You could leave the old IPAO/subclassing routines and just port the substantive code changes.
ucShellTree and ucShellBrowse was the very first project I ported... was just excited to try out tB and didn't think to keep the code completely compatible. I was thinking more along the lines of 'look for the FileExtensions property, it's associated variable and property, and add those in' rather than backport the entire project... that's going to be much more work. There's changes to be made to switch between WinDevLib and oleexp.tlb too. And IIRC I used tB syntax in other places. Later projects I tried to keep the code of existing projects compatible, but I've never gotten around to wholesale backporting the new ucShellTree/ucShellBrowse versions.
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
Mith
The use of the AddressOf operator doesn't work if the sublass functions are not in a module...
Even if the "WndProc" needs to reside in a module as to accommodate the "AddressOf" operator, all it does is forward messages to any of your classes that implement the "ISubclass" interface:
Code:
Private Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal Subclass As ISubclass, ByVal dwRefData As Long) As Long
Select Case uMsg
Case WM_NCDESTROY
UnSubclassWnd hWnd: WndProc = DefSubclassProc(hWnd, uMsg, wParam, lParam)
Case Else
WndProc = Subclass.WndProc(hWnd, uMsg, wParam, lParam, dwRefData)
End Select
End Function
ISubclass.cls
Code:
Public Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal dwRefData As Long) As Long
End Function
I haven't looked at Krool's controls but isn't he using the same subclassing method? It's pretty "boiler plate"...
-
2 Attachment(s)
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
I transfered all your changes from the Twinbasic control (v2.9.2) to the VB6 control excluding the Subclassing.
The control is running but now something is strange:
ucTree.OpenToPath "C:", True
Attachment 190277
drive C should be displayed under Computer and not as a child of the Desktop.
Expanding some items:
Attachment 190278
control properties:
Code:
ShowFavorites = False
Checkboxes = True
ShowFiles = False
AutoExpandComputer = False
AutoExpandLibraries = False
ShowQuickAccessOnWin10 = false
How to fix that?
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
Mith
I transfered all your changes from the Twinbasic control (v2.9.2) to the VB6 control excluding the Subclassing.
The control is running but now something is strange:
I checked the code between Twinbasic and VB6 again and found the problem!
Everything looks fine again!
I'll test some more and then report back.
-
2 Attachment(s)
crash: ExtendedOverlays=True
VB6SP6, Win10x64, uShell 2.9.2
I miss the overlay icons for LNK files, junctions and symbolic links in the tree.
Windows Explorer:
Attachment 190288
ucShellTree:
Attachment 190289
I set .ExtendedOverlays = True to get this overlay icons but the app/ide crashes when displayed.
Does ExtendedOverlays show the missing overlay icons or is this a new feature to add?
Code:
'v2.17 (Released 15 Mar 2020)
'
'-(Bug fix) The default overlays that should always stay on weren't showing (Link/Share)
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Extended overlays is for overlays besides links/junctions and shares; if you turn off extended overlays, the simple ones should still show:
Code:
lpIconOvr = -1
If mExtOverlay Then
Set pIconOvr = psf
pIconOvr.GetOverlayIndex pidlRel, lpIconOvr
End If
If (lpIconOvr > 15) Or (lpIconOvr < 0) Then
'Overlay icons are a mess. On Win7 there's a bunch in root that return 16, which is invalid
'and will cause a crash later one, and doesn't show anything. Shares never get shown so I'm
'going to manually set those
lpIconOvr = -1
If (lAtr And SFGAO_SHARE) = SFGAO_SHARE Then
lpIconOvr = 1
End If
If (lAtr And SFGAO_LINK) = SFGAO_LINK Then
lpIconOvr = 2
End If
End If
But it looks like a bug. Not sure how it happened because I specifically made sure it was working before I released the icon size update a few weeks ago.
I think Windows uses one or two more in some cases but it's mostly for apps that install custom ones; not too many do because there's a global system limit of 15. I'll investigate the crashing and why it's failing to show the overlays despite no errors setting them; the code is taken from ucShellBrowse where they're still working.
-
2 Attachment(s)
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
Quote:
Originally Posted by
fafalone
Extended overlays is for overlays besides links/junctions and shares; if you turn off extended overlays, the simple ones should still show:
With ucShell v2.7 the overlay icons are visible but the icon for a junction is wrong:
Attachment 190290
A junction uses a different icon than a symbolic link or a shortcut:
Attachment 190291
I guess the problem with the missing overlay icons is triggered by the new function EnsureOverlay:
Code:
lpIconOvr = -1
If mExtOverlay Then
Set pIconOvr = psf
pIconOvr.GetOverlayIndex pidlRel, VarPtr(lpIconOvr)
End If
If (lpIconOvr > 15) Or (lpIconOvr < 0) Then
'Overlay icons are a mess. On Win7 there's a bunch in root that return 16, which is invalid
'and will cause a crash later one, and doesn't show anything. Shares never get shown so I'm
'going to manually set those
lpIconOvr = -1
If (lAtr And SFGAO_SHARE) = SFGAO_SHARE Then
lpIconOvr = 1
End If
If (lAtr And SFGAO_LINK) = SFGAO_LINK Then
lpIconOvr = 2
End If
End If
EnsureOverlay lpIconOvr
-
Re: [VB6] ucShellTree - Full-featured Shell Tree UserControl
I debugged a little bit and it's not the new function "EnsureOverlay" because after this function returns the value of lpIconOvr is still 2 (LINK).
I guess there is something wrong with the ImageList that stores the overlay icons...
Quote:
Originally Posted by
Mith
I guess the problem with the missing overlay icons is triggered by the new function
EnsureOverlay:
Code:
lpIconOvr = -1
If mExtOverlay Then
Set pIconOvr = psf
pIconOvr.GetOverlayIndex pidlRel, VarPtr(lpIconOvr)
End If
If (lpIconOvr > 15) Or (lpIconOvr < 0) Then
'Overlay icons are a mess. On Win7 there's a bunch in root that return 16, which is invalid
'and will cause a crash later one, and doesn't show anything. Shares never get shown so I'm
'going to manually set those
lpIconOvr = -1
If (lAtr And SFGAO_SHARE) = SFGAO_SHARE Then
lpIconOvr = 1
End If
If (lAtr And SFGAO_LINK) = SFGAO_LINK Then
lpIconOvr = 2
End If
End If
EnsureOverlay lpIconOvr