LCL/(Shell)TreeView: Add property PathDelimiter to TCustomTreeView to allow OS path delimiter in ShellTreeView.

This commit is contained in:
wp_xyz 2022-11-08 15:30:03 +01:00
parent 94a92b78f2
commit 9cce03ac94
3 changed files with 7 additions and 3 deletions

View File

@ -3418,6 +3418,7 @@ type
FOnNodeChanged: TTVNodeChangedEvent;
FOnSelectionChanged: TNotifyEvent;
FOptions: TTreeViewOptions;
FPathDelimiter: String;
FRClickNode: TTreeNode;
FSaveItems: TStringList;
FScrollBars: TScrollStyle;
@ -3667,6 +3668,7 @@ type
property OnNodeChanged: TTVNodeChangedEvent read FOnNodeChanged write FOnNodeChanged;
property OnSelectionChanged: TNotifyEvent
read FOnSelectionChanged write FOnSelectionChanged;
property PathDelimiter: String read FPathDelimiter write FPathDelimiter;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
property RightClickSelect: Boolean
read GetRightClickSelect write SetRightClickSelect default False;

View File

@ -1419,7 +1419,7 @@ begin
while Assigned(Node) do
begin
if Result <> '' then
Result := '/' + Result;
Result := FOwner.FOwner.FPathDelimiter + Result;
Result := Node.Text + Result;
Node := Node.Parent;
end;
@ -2660,10 +2660,10 @@ var
begin
Result:=nil;
repeat
p:=System.Pos('/',TextPath);
p:=System.Pos(FOwner.FPathDelimiter,TextPath);
if p>0 then begin
CurText:=LeftStr(TextPath,p-1);
System.Delete(TextPath,1,p);
System.Delete(TextPath,1,p-1+Length(FOwner.FPathDelimiter));
end else begin
CurText:=TextPath;
TextPath:='';
@ -3483,6 +3483,7 @@ begin
FExpandSignColor := clWindowFrame;
FHotTrackColor := clNone;
FDisabledFontColor := clGrayText;
FPathDelimiter := '/';
// Accessibility
AccessibleDescription := rsTTreeViewAccessibilityDescription;
AccessibleRole := larTreeView;

View File

@ -638,6 +638,7 @@ begin
inherited Create(AOwner);
FInitialRoot := '';
FUseBuiltinIcons := true;
PathDelimiter := SysUtils.PathDelim;
// Initial property values
FObjectTypes:= [otFolders];