View Issue Details

IDProjectCategoryView StatusLast Update
0038522PackagesPackagespublic2021-02-25 15:08
Reporterjcmartini Assigned Towp  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
PlatformDesktopOSWindows  
Product Version2.0.10 
Summary0038522: TShellTreeView (TreeView.inc)
Description1) In function TTreeNode.GetTextPath: "Result := '/' + Result;" should be changed to : "Result := PathDelim + Result;"
2) In function TTreeNodes.FindNodeWithTextPath same change.
3) With Options tvoAllowMultiSelect CTRL+Click works fine, but Shift+Click does not work.
TagsNo tags attached.
Fixed in Revision64650
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Juha Manninen

2021-02-21 12:58

developer   ~0129056

Last edited: 2021-02-22 00:05

View 3 revisions

> 1) In function TTreeNode.GetTextPath: "Result := '/' + Result;" should be changed to : "Result := PathDelim + Result;"
> 2) In function TTreeNodes.FindNodeWithTextPath same change.

What is the bug caused by this?

wp

2021-02-21 19:04

developer   ~0129069

Last edited: 2021-02-21 19:50

View 5 revisions

> 1) In function TTreeNode.GetTextPath: "Result := '/' + Result;" should be changed to : "Result := PathDelim + Result;"
No. This "path" does not refer to the file system (TTreeView is much more general than files and folders), it refers to a one-string presentation of the parents of a node (e.g. root/grandparent/parent/child).

Since you also have ShelltreeView in the title of the report I guess that you want to apply this method to determine the full path of a node stored in the ShellTreeView, i.e. a full path of a file oder folder. For this purpose you should use the method TShellTreeView.GetPathFromNode(ANode). Here the correct path delimiters are inserted.

> 2) In function TTreeNodes.FindNodeWithTextPath same change.
Same - no change required.

> 3) With Options tvoAllowMultiSelect CTRL+Click works fine, but Shift+Click does not work.
Did you see the TreeView property MultiSelectStyle = (msControlSelect, msShiftSelect, msVisibleOnly, msSiblingOnly)? It gives you control over what happens when multi-select is active. When you add msShiftSelect to the set then it is possible to select a contiguous range of nodes by means of pressed SHIFT key.

jcmartini

2021-02-22 11:36

reporter   ~0129093

Last edited: 2021-02-22 12:04

View 5 revisions

I am speaking about TShellTreeView. This class is working with real paths. In Windows paths delimiters are '\' and not '/' . What's your solution ?
Where is in TShellTreeiew the MultiSelectStyle ? Multiselect with Shift+Click is the default in Windows.
ShellTreeView.items[i].GetTextPath; does not work !

wp

2021-02-22 12:35

developer   ~0129096

But treeview.inc belongs to the more general TTreeView. So, any change that you make here applies to any TTreeView instances, not only TShellTreeView. Changing the delimiter as you propose will break the code of a lot of people.

You do not seem to understand: the separator '/' used in TTreeview is NOT the PathDelimiter of the OS. When you need the full path of a selected shelltreeview item you should use the ShellTreeView function GetPathFromNode(node), not node.GetTextPath.

The property MultiSelectStyle is introduced by TCustomTreeView where it is declared as public. TTreeView publishes it, TShellTreeView, however, does not. Since there is no reason why this property should not be visible in the Object Inspector I published it in r64650. If you do not use trunk you still can use it by setting the needed value by code, e.g. in the form's OnCreate handler.

wp

2021-02-22 12:37

developer   ~0129097

(It's hard to decide how to classify the resolution here: part of the issue is "no change required", the other part is "fixed").

jcmartini

2021-02-23 10:39

reporter   ~0129119

Design error ?...

wp

2021-02-23 16:18

developer   ~0129123

What do you mean?

Again: When I create a treeview of my ancestry and want to write down the "path" to myself, i.e. grandgrandfather/grandfather/father/me, why should I use backslashes on Windows to separate each generation?

jcmartini

2021-02-24 16:21

reporter   ~0129146

One more time I am speaking about TShellTreeView. In that context Path is a FILE PATH not a generalized path, like these used for example with xml parsing. Did you already used TShellTreeView ? The error is maybe to choose of using TTreeView and TTreeNode for that purpose (?)

wp

2021-02-24 18:26

developer   ~0129148

I know that you are speaking of TShellTreeView. But TShellTreeView descends from TCustomTreeView, and thus inherits its basic functionality from TCustomTreeView. The common feature of both is TTreeNode. A TreeNode does not "know" whether it refers to the name of a file or the name of my grandfather. Therefore, it is meaningless to force it use the Windows path separators. It was the decision of the makers of TTreeView to separate the path elements in the TTreeNode method GetTextPath by normal slashes. Of course, the TShellTreeView cannot use this method due to the wronger slashes. Therefore, a new method GetPathFromNode was introduced for TShellView.

I am writing this in similar words for the third time now, but you seem not te read my messages. To avoid having an endless discussion here I am closing the report now (you can reopen the report, but I ask you to do this only with valid arguments).

Issue History

Date Modified Username Field Change
2021-02-21 10:35 jcmartini New Issue
2021-02-21 12:58 Juha Manninen Note Added: 0129056
2021-02-21 13:02 Juha Manninen Note Edited: 0129056 View Revisions
2021-02-21 19:01 wp Assigned To => wp
2021-02-21 19:01 wp Status new => assigned
2021-02-21 19:04 wp Status assigned => resolved
2021-02-21 19:04 wp Resolution open => no change required
2021-02-21 19:04 wp LazTarget => -
2021-02-21 19:04 wp Widgetset Win32/Win64 => Win32/Win64
2021-02-21 19:04 wp Note Added: 0129069
2021-02-21 19:06 wp Note Edited: 0129069 View Revisions
2021-02-21 19:06 wp Note Edited: 0129069 View Revisions
2021-02-21 19:49 wp Note Edited: 0129069 View Revisions
2021-02-21 19:50 wp Note Edited: 0129069 View Revisions
2021-02-22 00:05 Juha Manninen Note Edited: 0129056 View Revisions
2021-02-22 11:36 jcmartini Note Added: 0129093
2021-02-22 11:37 jcmartini Note Edited: 0129093 View Revisions
2021-02-22 11:39 jcmartini Note Edited: 0129093 View Revisions
2021-02-22 11:46 jcmartini Note Edited: 0129093 View Revisions
2021-02-22 12:04 jcmartini Note Edited: 0129093 View Revisions
2021-02-22 12:35 wp Note Added: 0129096
2021-02-22 12:35 wp Status resolved => assigned
2021-02-22 12:35 wp Resolution no change required => open
2021-02-22 12:37 wp Status assigned => resolved
2021-02-22 12:37 wp Resolution open => no change required
2021-02-22 12:37 wp Fixed in Revision => 64650
2021-02-22 12:37 wp Widgetset Win32/Win64 => Win32/Win64
2021-02-22 12:37 wp Note Added: 0129097
2021-02-23 10:39 jcmartini Note Added: 0129119
2021-02-23 16:18 wp Note Added: 0129123
2021-02-24 16:21 jcmartini Note Added: 0129146
2021-02-24 18:26 wp Note Added: 0129148
2021-02-24 18:27 wp Status resolved => closed