Can't drag files into ListBox in Windows

I searched for solution in the forum, since I realised some other people had the same issue, but after trying the “solutions”, it is still not working.

This is working perfectly on a Mac, but it doesn’t work on Windows.
I need to drag files from the Finder/Explorer into a ListBox (I just need to get their filenames).
I added a special/any FileType to the app and in the Open event of the ListBox, I added Me.AcceptFileDrop(DropTypes.All)

In the DropObject event, I have:

if obj.FolderItemAvailable = True then

The Windows Privileges are set to User, for the build.
This all works perfectly on the Mac, but I get a red stop sign when I try to drag any files into the ListBox, in Windows.
How can I make it work?

Set a FileType for text/plain
Set the ListBox to accept this file type
Drop a text file onto the ListBox.

It works ?

Unless you need to drop each and every file into the ListBox, you have a solution. Tell the ListBox to accept only the file type you need.

Thank you for the fast reply.
Actually, I need it to accept any file type. It could be text, images, audio, etc.

there is a feedback telling it do not works.

Now, this is against the normal way of dealing with drag and drop.

So, it is an “official” limitation?
Or, am I doing something wrong?

No and No.

It seems to be a bug.

And getting two times the same question in a couple of days seems suspect.

At last, the File Type feature wad added for good reason.

Displaying what a file is is beyond that reason.

Using special/any is not the panacea.

You still will have to write code to explain what the dropped file is. So adding File Type for each item you want to deal with is still a good idea: it allow you to do what you want:

if f.Type = “plain/text” Then
// display what a plain text file is
Else…

Of the use of Select Case:

Select f.Type

Case “plain/text”

Of course, you have to match File Types to the code.

I understand that.
The problem is that it could really be any file, because this is an app to manage filenames. So, the file type is really not important and it should receive ALL types of files.

The previous question on that very same question:

I understand.

What if your user drop a file named Thumbs.db ?
Or Desktop.ini or…

I am sorry.

You may refector your application and simply display all files in a ListBox and let the user choose from there the files (s)he needs to work with.

Doing so avoid the file type current mess (by pass it).

You only have to use a folder and load its contents by iterate it (For i = 1 to File_Count…)

So, “officially”, there is no way, in Windows, to select a bunch of files and drop them in a ListBox?

Apparently.

Until something happens. If this is a bug, a new version (when ?) will remove it / restore the previous behavior.

Did you read the Feedback report ?

You also may use Xojo 2020r2.1 in the mean time.

I confess that I didn’t.
But I will read it.
Thank you so much.

You’re welcome.

Have you set up a *.* extension in your DropTypes?

I have it working here in 2021r1 without issue.

It’s AMAZING!!!
So the only thing that is missing is one *
I changed the .* into *.* and it all works like a charm!
Thank you, thank you, thank you!

1 Like

Will try it tomorrow. It is very late here now.
But I hope that is the simplest solution :slight_smile:

and this is documented where?

The cobwebbed card index system that is my brain :wink:

As far as I’m aware, it’s not documented, because Windows.

Technically * works too as . is optional but you should really use *.* as that is the wildcard for all files with all extensions and a user in windows would expect to see that in their file dialogs types under All Files.

As I alter/user them so infrequently I always cringe when I have to look at UserGuide:File Type Group Editor - Xojo Documentation as its just a wall of text. Macos only stuff is mixed in with general stuff, like mime types are macos only so why aren’t they in the macos only section and Windows things are wrong like “only the extensions need to be specified in order for file dialogs to limit the selection of files” when its clearly also needed for drag and drop.

2 Likes

I’ve always considered these “wildcards” as garbage. Hope they’ll eventually create something more robust one day…

Damn forum . above should be “use *.* as”, if someone can, feel free to fix that for me? Ta

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.