I’ve been using the HTMLViewer control present a UI from a standard web site. This site implements a drag and drop upload interface that I simply can’t get to work when I present the UI via a HTMLViewer.
This is on Mac OS X.
I added some AcceptFileDrop and AcceptPictureDrop calls to my HTMLViewer.open method but this doesn’t produce any results. The cursor icon doesn’t change and none of the Drag or Drop events fire.
In contrast, if I add the same AcceptFileDrop calls to the window.open method and move the HTMLViewer control to one-side, I get the events in the window - but of course this doesn’t have any impact on the web UI. Clearly the file type definitions are correct.
Should this work?
I note also that if I use a different URL, I can always drag and drop image files to the HTMLViewer, which I guess is standard behaviour.
When you access the same site from Safari, does it work ?
Sure does. It even works if I use Fluid (http://fluidapp.com) to create a native app tool from it.
There are several ways to implement file drag and drop. In the past, that was quite hackish and did not always work on all browsers.
Today most of the time the HTML5 code is used. It is possible that the current HTMLViewer implementation does not support that feature fully. I did not observe that before, though.
When you drop a file, what happens ? Especially a picture ?
Essentially - the HTMLViewer control doesn’t even appear to fire any Drag or Drop event when this page is loaded.
For other sites:
Here is the code in the window.open method:
I have some simple logging code in the Window and HTMLViewer1 DragEnter and DragOver methods:
I return false for all.
Some pages exhibit the ‘normal’ (albeit undesirable) behaviour of loading a image file into the the HTMLViewer when dropped. I’ve seen work-arounds to prevent that if needed. You can see this if you use http://www.apple.com for example and even while the ‘loading’ page is displayed with this specific website.
Once the ‘full’ asana UI is loaded however this no longer works. Guessing therefore there is something about the page that prevents the ‘normal’ function and I can’t get my Xojo app to even recognise the drag behaviour.
I do not quite grasp what you are describing.
Are we talking about a page you create and load in the HTMLViewer, which would explain why you try to set the me.AcceptDrop, or are we talking about a web site you access with the HTMLViewer ? If the latter, the URL would help greatly.
At any rate, if you could post a project showing the issue, that would be a lot better than simply discussing in the air.
It’s an existing web site I am putting into HTMLViewer via a LoadURL call.
Here is a link to the example project;
If you want to PM me - I can share a test logon to the website so you can see what’s happening.
Just click on my name, and in the profile page, click on “start a private conversation”.
OK. It does appear the method they have elected to enable drop files is not compatible with Xojo HTMLViewer.
I do not see any available workaround. Sorry.
Thanks very much for taking a look… Glad to know at least I wasn’t doing something stupid.
Hey - I made progress on this.
Firstly: you need to make sure the agent string is actually set in the htmlviewer open event.
agent = “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16”
Me.UserAgent = agent
Second: with the help of the MBS plugin I’ve got the web app to recognise the drag and drop event.
I had to implement the dragDestinationActionMaskForDraggingInfo method of the WebUIDelegateMBS class and return a value of 65535 (WebDragDestinationAction)
(actually Christian did an update to support that extra method)
So far so good.
Xojo itself does certainly not support much drag and drop for the htmlviewer on desktop.
If you need we have some things for Mac in the MBS Plugins.
If you are interested you can email me so I can send latest plugin.