473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 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 3962
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ryan Stewart | last post by:
If you don't want to read this post because of its length, I understand. I've spent two and a half days on this problem and have a good deal of information to relate. And this is kind of a long...
7
by: Johann Wagner | last post by:
Hello! I want to drop an email in my C# application. I get the drop event and the dataobject. But i cannot interpret the data in the dataobject. So i cannot get the email. I have found a code...
2
by: Dolorous Edd | last post by:
Hi, for a program I'm working on I need to be able to drag multiple files between Windows Explorer and a ListBox, in both directions. Implementing the "drag in" was pretty easy, but I can't find...
0
by: Robin Tucker | last post by:
Hi there, I have a list box (just happens to be owner draw). When I select multiple items using the CTRL key, the items I have selected become highlighted (obviously). Now, when I click on one...
1
by: Terry Olsen | last post by:
My first time using TreeViews. I have TreeView1 set up to display my directory structure just like Windows Explorer. I can drag & drop files and folders over to TreeView2. I can re-arrange the...
0
by: orientphoebus | last post by:
I tried the new Visual Studio 2005 Team System + VSS2005, no Team Foundation Server. Some questions pop into my head: 1. WITHOUT TFS, can VSS2005 integrated with VS2005? What I like is the VS6...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
1
by: =?Utf-8?B?VnUtTG9jIE5ndXllbg==?= | last post by:
The history: I have a C# form that must accept files "drag and drop" including Outlook messages .msg. In order to support Outlook .msg file drop, I must use Ole32 (regular .net drag and drop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.