Setting filetype for XFDF?

I just don’t know enough about Windows but need to compile a desktop project created on a Mac for it now.

So far, I got everything running under Parallels, but the app’s main window is intended to accept a file drop from XFDF files (that‘s XML type files for Adobe Acrobat, in this case containing the fields and value from a PDF form).

This works fine on a Mac in the open event of a canvas on the window:

dim fdftype as new filetype fdftype.Extensions="fdf;xfdf" me.AcceptFileDrop(fdftype)

But on Windows (XP) the file icon turns to a “not permitted” sign when I try to drop it. Guess I have to extend the definition – but how?

mime type is application/vnd.adobe.xfdf

Hope this helps.

I put that value under fdftype.maccreator, but no change under Windows. I can open a file via folderitem.dlg.showmodal, but not drop it onto the canvas. But thanks anyway!

the filetype goes out of scope

I quickly tried code I use on Mac under Windows, and it is very disappointing : No object dropped over a groupbox is ever accepted, no matter the file type in AcceptFileDrop :confused: There must be something should know ; apps such as Paint. Net do accept file drop :frowning:

FOLKS - The file type goes goes out of scope
Keep the thing in a property on the window or in a FileType set and it probably will work

This has been the case for about 5 years
http://forums.realsoftware.com/viewtopic.php?f=1&t=41969

As Norman points out FileType must be defined in the project or as a property. It will not work if declared within AcceptFileDrop.

Norman, the old Realsoftware forum thread never seem to have found the solution :frowning:

I defined the FileType “Any” in a File Type set.

Then I place me.AcceptFileDrop("Any") in the Open event.

Still, upon run, I cannot drag anything in a window, a rectangle or a groupbox :confused:

Still looking for something that works…

Same here. Everything’s fine under Mac OS, but Windows don’t care if I define the filetype in a window- or app-property (and accept.filedrop in the open event of a canvas of course).

I would rather guess that I have a wrong idea of file types and how to set them. On the other hand, I followed most what I could find in this forum and it still doesn’t work for my Windows installation.

These are mostly copy pastes from documentation.xojo.com but I tested it just now and verified it works.

  1. Create a filetype set. I put one in the project rather than messing with a property then added the type special/any.

  2. I put this code in my open event for the window.

me.AcceptFileDrop(FileTypes1.All)
  1. I put this code in my Dropobject event.

If Obj.PictureAvailable Then Me.backdrop = obj.Picture ElseIf Obj.FolderItemAvailable Then Me.backdrop = Picture.Open(obj.FolderItem) End If

  1. Run the program and drag a picture on it.

This could have been done easily with specific file types and a rect control.

Bob, the me.AcceptFileDrop(FileTypes1.All) is what I needed to make it work.

Thank you :slight_smile:

Then I place me.AcceptFileDrop("Any")

“ANY” is not the name of the item in the file type set :stuck_out_tongue:
Its JUST a string (which should match an extension I believe)
Filestypes.Any is the object name

[quote=77941:@Norman Palardy]Then I place me.AcceptFileDrop("Any")

“ANY” is not the name of the item in the file type set :stuck_out_tongue:
Its JUST a string (which should match an extension I believe)
Filestypes.Any is the object name[/quote]

Documentation for AcceptFileDrop is not quite explanatory enough which only states RectControl.AcceptFileDrop ( FileType as String ) . From that, it is not easy to guess RectControl.AcceptFileDrop ( FileTypes.Any ) is what should be entered.

Well. There are more mysteries in Xojo than my philosophy can fathem :wink:

I just tested this and it is because you are missing a semi-colon. RectControl.AcceptFileDrop("special/any;") worked for me.

Sadly the docs leave out the semi-colon so I am unsure whether the documentation or the semi-colon is the real bug in this case. Personally I prefer to define the object and use that where needed.

[quote=77946:@Bob Coleman]I just tested this and it is because you are missing a semi-colon. RectControl.AcceptFileDrop("special/any;") worked for me.

Sadly the docs leave out the semi-colon so I am unsure whether the documentation or the semi-colon is the real bug in this case. Personally I prefer to define the object and use that where needed.[/quote]

This exchange is exactly why this forum is an irreplaceable resource : you provided me with a precious undocumented detail I would have never been able to try.

Thank you so much.

How I found it was simply to put msgbox(FileTypes1.All) in the open event of my program to see what came up.

Filetypes are kind of … special … lets say :slight_smile:

Sorry, but it’s still not working for me. Under Mac OS yes, but still not under Windows.
Could you please explain more verbose or post a complete code sample of a window (container) that accepts every file (or et least XFDF) under windows? I don’t get it where my code differ from what you all have written here.

And again: Thanks a lot to all of you. Yes, it is amazing hot often and fast this forum comes up with a solution.

Here is what I did that now works and accepts any file, with the help of Bob Coleman :

  • Insert/File Type Set
  • In the File Type, click the second icon from the left and select special/any. It creates an “Any” filetype

In Window1.Open :

Sub Open() Me.AcceptFileDrop(FileTypes1.Any) End Sub

In Window1.DropObject :

Sub DropObject(obj As DragItem, action As Integer) msgbox Obj.FolderItem.Name End Sub

Now whatever the kind of file I drop over the window, the MsgBox tells me its name.

You can then filter right(Obj.FolderItem.Name,5) = “.xfdf” and process.

Yeeees! Thanks a lot, Michel!
As it seems the filetypes settings are really not clear to me yet. I had entered the file type manually in the wrong column, had not seen there was a dropdown that fills everything correctly.
What relieve!