Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-04

ShellTreeView/ShellListView and Root

19 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

I'm probably missing something here..

I have a ShellTreeView which is coupled with a ShellListView. At designtime I set ShelltreeView.Root to 'C:\' (I'm on Windows).

I build and run.
When the program starts the ShellTreeView has nothing selected and ShellListView is populated with all files in C:\

Now I select any node in ShellTreeView and ShellListView responds as expected.

The problem I'm having is that I cannot get back to the root (C:\) anymore, and by that I mean the situation as it was as startup, and populate ShellListView with the files in C:\.
If I query ShellTreeView.Root it is always some subfolder of C:\.

Both components have all properties unchanged (so all defaults).

I would have expected for ShellTreeView to look something like this:

C:\

foo bar Lazarus

But is shows like this:

foo bar Lazarus

Bart

Reply by email

Bart
to Bart
Bart wrote
See attached diff. Would that be a viable approach?

Never mind, this (my patch) doesn't work.

Does Delphi's ShellTreeView have the same problem as I described? If not, I'll open a ticket in the bugtracker.

Bart

Reply by email

Felipe Monteiro de Carvalho
to Bart
Bart wrote
Does Delphi's ShellTreeView have the same problem as I described?

Yes, it would be great if someone checked this. I don't have Delphi, so can't check.

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Bart

And if you set Root=C:\Documents and Settings\Someone\Otherfolder

Will it show the root as "C:\Documents and
Settings\Someone\Otherfolder" or as "Otherfolder" ?

Felipe Monteiro de Carvalho

Reply by email

Bart
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
And if you set Root=C:\Documents and Settings\Someone\Otherfolder Will it show the root as "C:\Documents and Settings\Someone\Otherfolder" or as "Otherfolder" ?

It will not show the root at all, see original patch sort of worked, but only if you uses a fully qualified path for it.

Bart

Reply by email

Felipe Monteiro de Carvalho
to Bart: Committed in r40732. Bart
Bart wrote
Committed in r40732.

I was planning on reviewing it today. I don't like this chunk:

@@ -631,7 +641,6 @@
 begin
   // avoids crashes in the IDE by not populating during design
   if (csDesigning in ComponentState) then Exit;
-
   r := GetLogicalDriveStrings(SizeOf(Drives), Drives);
   if r = 0 then Exit;
   if r > SizeOf(Drives) then Exit;

The empty line marks the region for which the comment is valid, it should have been deleted.

Also:

+  if not FilenameIsAbsolute(Result) then
+    Result := GetRootPath() + Result;    // Include root directory

I think this is redundant, this entire part could be deleted I think.

Felipe Monteiro de Carvalho

Reply by email

Hans-Peter Diettrich
to Graeme Geldenhuys: Shouldn't file and directory management be left up to the file manager of each OS? If…
Show quoted text 5 lines
On 2013-04-06 13:49, Bart wrote: > * Editing a "node" will actually rename the folder (as users expect) Shouldn't file and directory management be left up to the file manager of each OS? If not, where is this going to end?

On Windows the Explorer consists of just these two components, which implement most of its file management functionality. So either component *is* an OS (Windows) file manager. The OS file access rights are considered sufficient to protect the machine against the user.

Editing directory names is required whenever the user wants to save something into a new directory. Then the component allows to create a new directory first, then to rename it as desired.

DoDi

Reply by email

Bart
to Felipe Monteiro de Carvalho: I was planning on reviewing it today. I don't like this chunk: @@ -631,7 +641,6 @@ begin…
Felipe Monteiro de Carvalho wrote 13 lines
I was planning on reviewing it today. I don't like this chunk: @@ -631,7 +641,6 @@ begin // avoids crashes in the IDE by not populating during design if (csDesigning in ComponentState) then Exit; - r := GetLogicalDriveStrings(SizeOf(Drives), Drives); if r = 0 then Exit; if r > SizeOf(Drives) then Exit; The empty line marks the region for which the comment is valid,

?? I don't un derstand what you mean by that last line. Anyhow it has been there before I started playing with it.

Show quoted text 6 lines
Also: + if not FilenameIsAbsolute(Result) then + Result := GetRootPath() + Result; // Include root directory I think this is redundant, this entire part could be deleted I think.

Without it, it didn't work at some time.
I'll re-test, because since I put that one in, I've changed some more.

Bart

Reply by email

Bart
to Hans-Peter Diettrich: On Windows the Explorer consists of just these two components, which implement most of…
Hans-Peter Diettrich wrote 17 lines
Graeme Geldenhuys schrieb: > On 2013-04-06 13:49, Bart wrote: >> * Editing a "node" will actually rename the folder (as users expect) > > Shouldn't file and directory management be left up to the file manager > of each OS? If not, where is this going to end? On Windows the Explorer consists of just these two components, which implement most of its file management functionality. So either component *is* an OS (Windows) file manager. The OS file access rights are considered sufficient to protect the machine against the user. Editing directory names is required whenever the user wants to save something into a new directory. Then the component allows to create a new directory first, then to rename it as desired. DoDi

Well, to be honest, current implementation kind of sucks. I made it a little better (I hope) with my changes to SetRoot and SetPath. At least it looks better and navigates better now. (Somebody needs to test this on WinCE!)

Ultimately, if we want some kind of Delphi compatibility, we should let the widgetset/OS do drawing/populating/interacting with FS, just like TSelectDirectoryDialog.

This is however far beyond my capabilities.

Bart

Reply by email

Bart
to Juha Manninen
Juha Manninen wrote 10 lines
On Mon, Apr 8, 2013 at 7:33 PM, Bart wrote: >> The empty line marks the region for which the comment is valid, > ?? I don't un derstand what you mean by that last line. Anyhow it has > been there before I started playing with it. Felipe means that you removed an empty line but you shouldn't because it carried information. Anyway, it does not affect the functionality for sure. Juha

OK, now I understand.
Didn't notice that.

Restored in r40753

Bart

Reply by email