Drag and drop not accepted by canvas or imagewell

I wrote in the open-Event of the canvas

Me.AcceptPictureDrop me.AcceptFileDrop("image/jpeg")
and as it is written in all pages I looked at - i wrote into the dropobjekt-event

If Obj.PictureAvailable Then Me.backdrop = obj.Picture ElseIf Obj.FolderItemAvailable Then Me.backdrop = Picture.Open(obj.FolderItem) End If
But all pictures are refused by the canvas.
(Taking it from DeskTop) - System Windows 8.1
Is there any other thing I have to do?

Did you define a file type for "image/jpeg" ?

OK: I do what you said and it does not works (here) too.

So, I added a File Type Set (menu Insert) for "image/jpeg". It does not works too.

So, I checked what I had in front of me to discover that the Open Event I fill with your code was Window1, not Canvas1 *

Once I put the code in Canvas1.DropObject, and run, it worked fine (btw: I commented out the line Me.AcceptPictureDrop ).

  • When I wrote “I feel insecure when using Xojo’s IDE, I was right ! The Intended DropObject Event to fill with code does not go to the Canvas Control, but to Window1 !

And in a project with…7 lines !!!

[quote=95219:@Emile Schwarz]Did you define a file type for "image/jpeg" ?

OK: I do what you said and it does not works (here) too.

So, I added a File Type Set (menu Insert) for "image/jpeg". It does not works too.

So, I checked what I had in front of me to discover that the Open Event I fill with your code was Window1, not Canvas1 *

Once I put the code in Canvas1.DropObject, and run, it worked fine (btw: I commented out the line Me.AcceptPictureDrop ).

  • When I wrote “I feel insecure when using Xojo’s IDE, I was right ! The Intended DropObject Event to fill with code does not go to the Canvas Control, but to Window1 !

And in a project with…7 lines !!![/quote]

The OP uses Windows, which is kind of picky as far as drag and drop is concerned.

But the first thing I would try indeed would be to try adding a FileTypes to the project, add JPeg to it, and write line 2 as :

  me.AcceptFileDrop(FileTypes1.Jpeg)

Trying this out, I must say: I dant see the canvas in Runtime. Is this normal?
May be the drag and drop would work, but with no canvas there?

Now it worked - so I have to draw a rectangle around the canvas to mark it and the user can put a picture into this box.

After reading through some comments I think, now after having a picture dropped in the canvas, I cannot store it into the database - or?

Dim dbPic as Picture = CanvasName.BackDrop

And store the picture as normal in a database (blob) or field as PictureValue.

thks