471,601 Members | 1,210 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

Drag & Drop - Order of files/folders when multiple selection

Hi all,

I hope somebody can help me with following problem:

I have an application where I can drag&drop files/dirs from within explorer
onto my form.

If multiple files/dirs are selected I can see that the order I get in my
drop event is not always the same as displayed in the explorer window.
Further more the order changes depending on how many files/dirs are
selected. It looks like a 'random' order to me.

Is there any possibility within C#/.NET 2.0/3.0 to detect the file order
depening on the order the files/dirs were selected in the explorer window?

Many thanks in advance for any help!

Hartmut

Feb 22 '07 #1
3 3778
Hello Hartmut,

I don't think there's a way to do that - although I'm not exactly sure for
which order you're asking:
>... the order ... is not always the same as displayed in the explorer
window.
>... detect the file order depening on the order the files/dirs were
selected ...
This sounds like two different things to me - the order that is shown in
Explorer vs. the order in which files were selected. As far as I remember,
the order of file/dir info being passed in would actually be the same as
the order in which they were selected, but I could be wrong - in any case
I don't think that this is part of the spec, and so I wouldn't rely on it.
Oliver Sturm
--
http://www.sturmnet.org/blog
Feb 24 '07 #2
Hello Oliver,

thanks for that reply.

I did some debugging to see the order I get in my drag & drop event compared
to the order the files/dirs are selected. However I cannot see any rule as
when I select multiple files/dirs (not just 2, but e.g. 10) I do not get the
entries in the order of files/dirs in explorer and also not in the order the
files/dirs are selected. Mybe it's the order the files/dirs are stored in
the file system.

So I think to let a user pick the order I always need to provide a list of
selected files/dirs where a user can rearange the files/dirs. This is
exactly what I wanted to avoid.

Hartmut

"Oliver Sturm" <ol****@sturmnet.orgschrieb im Newsbeitrag
news:xn****************@msnews.microsoft.com...
Hello Hartmut,

I don't think there's a way to do that - although I'm not exactly sure for
which order you're asking:
>>... the order ... is not always the same as displayed in the explorer
window.
>>... detect the file order depening on the order the files/dirs were
selected ...

This sounds like two different things to me - the order that is shown in
Explorer vs. the order in which files were selected. As far as I remember,
the order of file/dir info being passed in would actually be the same as
the order in which they were selected, but I could be wrong - in any case
I don't think that this is part of the spec, and so I wouldn't rely on it.
Oliver Sturm
--
http://www.sturmnet.org/blog

Feb 26 '07 #3
On Mon, 26 Feb 2007 20:19:02 +0800, Hartmut Dippon
<ha************@hotmail.comwrote:
>
I did some debugging to see the order I get in my drag & drop event
compared to the order the files/dirs are selected. However I cannot see
any rule as when I select multiple files/dirs (not just 2, but e.g. 10)
I do not get the entries in the order of files/dirs in explorer and also
not in the order the files/dirs are selected. Mybe it's the order the
files/dirs are stored in
the file system.
My recollection is that Windows Explorer multi-file select goes something
like this:

1) Files are added to the file list LIFO. The most recently selected
file is first in the list.
2) When selecting more than one new file at a time (drag-rect,
shift-select a list, etc), the group is in order according to how they
appear in Windows Explorer, but the whole group is added at the front of
the selection
3) Clicking the final selection may result in one file (the file you
clicked to represent the whole group) being moved to the beginning of the
selection list

Of course, as Oliver notes there is no (as far as I know) documented
specification as to multi-select behavior for Windows Explorer. That is,
even if the above recollection is accurate, it should not be depended on.
It could change at any time.
So I think to let a user pick the order I always need to provide a list
of selected files/dirs where a user can rearange the files/dirs. This is
exactly what I wanted to avoid.
I'm not sure what it was you expected. Most applications that involve
themselves in lists of files generally do not depend on the files being in
any specific order. In those cases, they almost always simply display the
files in alphabetical order. In applications where order does matter,
since there is no way to guarantee that the user is necessarily going to
add the files in the right order in the first place, a UI to allow the
order of the files to be changed is always included. This is the
user-friendly thing to do.

If your application processes the filenames in some specific order, and
the order is important, I'm curious to know what your expectation of the
user specifying the order would have been? Was it your thought that the
user would be required to understand that the order in which they select
the files in Windows Explorer is important and results in an immutable
order in your own application? If so, I'd suggest that's not a very
user-friendly method of defining the order. If not, then it seems to me
that either you can reorder the files in your application (alphabetically,
for example, but any repeatable, predictable, documented method would be
fine), or you can allow the user to reorder the files manually, or both
(personally, if order matters, I'd recommend doing both).

Pete
Feb 28 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ryan Stewart | last post: by
2 posts views Thread by Dolorous Edd | last post: by
1 post views Thread by Terry Olsen | last post: by
reply views Thread by orientphoebus | last post: by
1 post views Thread by =?Utf-8?B?VnUtTG9jIE5ndXllbg==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.