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

View File

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

View File

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